| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | |
| | | * @throws LDAPException If an error occurs while interacting with an LDAP |
| | | * element. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while interacting with an ASN.1 |
| | | * @throws DecodeException If an error occurs while interacting with an ASN.1 |
| | | * element. |
| | | */ |
| | | public LDAPResult doOperation(ObjectFactory objFactory, |
| | | AddRequest addRequest, |
| | | List<org.opends.server.types.Control> controls) |
| | | throws IOException, LDAPException, ASN1Exception |
| | | throws IOException, LDAPException, DecodeException |
| | | { |
| | | LDAPResult addResponse = objFactory.createLDAPResult(); |
| | | addResponse.setRequestID(addRequest.getRequestID()); |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.CompareRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | * @throws LDAPException If an error occurs while interacting with an LDAP |
| | | * element. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while interacting with an ASN.1 |
| | | * @throws DecodeException If an error occurs while interacting with an ASN.1 |
| | | * element. |
| | | */ |
| | | public LDAPResult doOperation(ObjectFactory objFactory, |
| | | CompareRequest compareRequest, |
| | | List<org.opends.server.types.Control> controls) |
| | | throws IOException, LDAPException, ASN1Exception |
| | | throws IOException, LDAPException, DecodeException |
| | | { |
| | | LDAPResult compareResponse = objFactory.createLDAPResult(); |
| | | compareResponse.setRequestID(compareRequest.getRequestID()); |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | * @throws LDAPException If an error occurs while interacting with an LDAP |
| | | * element. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while interacting with an ASN.1 |
| | | * @throws DecodeException If an error occurs while interacting with an ASN.1 |
| | | * element. |
| | | */ |
| | | public LDAPResult doOperation(ObjectFactory objFactory, |
| | | DelRequest deleteRequest, |
| | | List<org.opends.server.types.Control> controls) |
| | | throws IOException, LDAPException, ASN1Exception |
| | | throws IOException, LDAPException, DecodeException |
| | | { |
| | | LDAPResult delResponse = objFactory.createLDAPResult(); |
| | | delResponse.setRequestID(deleteRequest.getRequestID()); |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | * @throws LDAPException If an error occurs while interacting with an LDAP |
| | | * element. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while interacting with an ASN.1 |
| | | * @throws DecodeException If an error occurs while interacting with an ASN.1 |
| | | * element. |
| | | */ |
| | | public ExtendedResponse doOperation(ObjectFactory objFactory, |
| | | ExtendedRequest extendedRequest, |
| | | List<org.opends.server.types.Control> controls) |
| | | throws IOException, LDAPException, ASN1Exception |
| | | throws IOException, LDAPException, DecodeException |
| | | { |
| | | ExtendedResponse extendedResponse = objFactory.createExtendedResponse(); |
| | | extendedResponse.setRequestID(extendedRequest.getRequestID()); |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ModifyDNRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyDNResponseProtocolOp; |
| | |
| | | * @throws LDAPException If an error occurs while interacting with an LDAP |
| | | * element. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while interacting with an ASN.1 |
| | | * @throws DecodeException If an error occurs while interacting with an ASN.1 |
| | | * element. |
| | | */ |
| | | public LDAPResult doOperation(ObjectFactory objFactory, |
| | | ModifyDNRequest modifyDNRequest, |
| | | List<org.opends.server.types.Control> controls) |
| | | throws IOException, LDAPException, ASN1Exception |
| | | throws IOException, LDAPException, DecodeException |
| | | { |
| | | LDAPResult modDNResponse = objFactory.createLDAPResult(); |
| | | modDNResponse.setRequestID(modifyDNRequest.getRequestID()); |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | |
| | | * @throws LDAPException If an error occurs while interacting with an LDAP |
| | | * element. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while interacting with an ASN.1 |
| | | * @throws DecodeException If an error occurs while interacting with an ASN.1 |
| | | * element. |
| | | */ |
| | | public LDAPResult doOperation(ObjectFactory objFactory, |
| | | ModifyRequest modifyRequest, |
| | | List<org.opends.server.types.Control> controls) |
| | | throws IOException, LDAPException, ASN1Exception |
| | | throws IOException, LDAPException, DecodeException |
| | | { |
| | | LDAPResult modResponse = objFactory.createLDAPResult(); |
| | | modResponse.setRequestID(modifyRequest.getRequestID()); |
| | |
| | | import javax.xml.bind.JAXBElement; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPConstants; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | |
| | | while (opType != LDAPConstants.OP_TYPE_SEARCH_RESULT_DONE); |
| | | |
| | | } |
| | | catch (ASN1Exception ae) |
| | | catch (DecodeException ae) |
| | | { |
| | | ae.printStackTrace(); |
| | | throw new IOException(ae.getMessage()); |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.controls.ProxiedAuthV2Control; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.LDAPConstants; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | LocalizableMessage m = INFO_RESULT_CLIENT_SIDE_ENCODING_ERROR.get(); |
| | | throw new LDAPConnectionException(m, CLIENT_SIDE_CONNECT_ERROR, null, le); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage m = INFO_RESULT_CLIENT_SIDE_ENCODING_ERROR.get(); |
| | | throw new LDAPConnectionException(m, CLIENT_SIDE_CONNECT_ERROR, null, |
| | | ae); |
| | | throw new LDAPConnectionException(m, CLIENT_SIDE_CONNECT_ERROR, null, ae); |
| | | } |
| | | catch (IOException ie) |
| | | { |
| | |
| | | * @return a JAXBElement that contains an ErrorResponse |
| | | */ |
| | | private JAXBElement<ErrorResponse> createErrorResponse(Throwable t) { |
| | | // potential exceptions are IOException, LDAPException, ASN1Exception |
| | | // potential exceptions are IOException, LDAPException, DecodeException |
| | | |
| | | ErrorResponse errorResponse = objFactory.createErrorResponse(); |
| | | errorResponse.setMessage(String.valueOf(t)); |
| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import static org.opends.server.core.DirectoryServer.getMaxInternalBufferSize; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import static org.opends.messages.JebMessages.*; |
| | | |
| | | import static org.forgerock.util.Utils.closeSilently; |
| | | import com.sleepycat.je.*; |
| | | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.api.CompressedSchema; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | import com.sleepycat.je.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | |
| | | import java.util.zip.DeflaterOutputStream; |
| | | import java.util.zip.InflaterOutputStream; |
| | | |
| | | import static org.forgerock.util.Utils.*; |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | |
| | | /** |
| | | * Represents the database containing the LDAP entries. The database key is |
| | | * the entry ID and the value is the entry contents. |
| | |
| | | |
| | | private void release() |
| | | { |
| | | closeSilently(writer); // Clears encodedBuffer as well. |
| | | closeSilently(writer); |
| | | encodedBuffer.clearAndTruncate(maxBufferSize, BUFFER_INIT_SIZE); |
| | | entryBuffer.clearAndTruncate(maxBufferSize, BUFFER_INIT_SIZE); |
| | | compressedEntryBuffer.clearAndTruncate(maxBufferSize, BUFFER_INIT_SIZE); |
| | | } |
| | | |
| | | private Entry decode(ByteString bytes, CompressedSchema compressedSchema) |
| | | throws DirectoryException, ASN1Exception, LDAPException, |
| | | throws DirectoryException, DecodeException, LDAPException, |
| | | DataFormatException, IOException |
| | | { |
| | | // Get the format version. |
| | | byte formatVersion = bytes.byteAt(0); |
| | | if(formatVersion != JebFormat.FORMAT_VERSION) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_JEB_INCOMPATIBLE_ENTRY_VERSION.get(formatVersion); |
| | | throw new ASN1Exception(message); |
| | | throw DecodeException.error(ERR_JEB_INCOMPATIBLE_ENTRY_VERSION.get(formatVersion)); |
| | | } |
| | | |
| | | // Read the ASN1 sequence. |
| | |
| | | * @param bytes A byte array containing the encoded database value. |
| | | * @param compressedSchema The compressed schema manager to use when decoding. |
| | | * @return The decoded entry. |
| | | * @throws ASN1Exception If the data is not in the expected ASN.1 encoding |
| | | * @throws DecodeException If the data is not in the expected ASN.1 encoding |
| | | * format. |
| | | * @throws LDAPException If the data is not in the expected ASN.1 encoding |
| | | * format. |
| | |
| | | */ |
| | | public static Entry entryFromDatabase(ByteString bytes, |
| | | CompressedSchema compressedSchema) throws DirectoryException, |
| | | ASN1Exception, LDAPException, DataFormatException, IOException |
| | | DecodeException, LDAPException, DataFormatException, IOException |
| | | { |
| | | EntryCodec codec = acquireEntryCodec(); |
| | | try |
| | |
| | | import org.opends.server.api.CompressedSchema; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import com.sleepycat.je.Cursor; |
| | | import com.sleepycat.je.Database; |
| | |
| | | private static final String DB_NAME_OC = "compressed_object_classes"; |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | // The compressed attribute description schema database. |
| | | /** The compressed attribute description schema database. */ |
| | | private Database adDatabase; |
| | | |
| | | // The environment in which the databases are held. |
| | | /** The environment in which the databases are held. */ |
| | | private Environment environment; |
| | | |
| | | // The compresesd object class set schema database. |
| | | /** The compressed object class set schema database. */ |
| | | private Database ocDatabase; |
| | | |
| | | private final ByteStringBuilder storeAttributeWriterBuffer = |
| | |
| | | // Ignore. |
| | | } |
| | | |
| | | try |
| | | { |
| | | adDatabase.close(); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | // Ignore. |
| | | } |
| | | StaticUtils.close(adDatabase); |
| | | |
| | | try |
| | | { |
| | |
| | | // Ignore. |
| | | } |
| | | |
| | | try |
| | | { |
| | | ocDatabase.close(); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | // Ignore. |
| | | } |
| | | StaticUtils.close(ocDatabase); |
| | | |
| | | adDatabase = null; |
| | | ocDatabase = null; |
| | |
| | | LockMode.READ_UNCOMMITTED); |
| | | } |
| | | } |
| | | catch (final ASN1Exception ae) |
| | | catch (final IOException e) |
| | | { |
| | | logger.traceException(ae); |
| | | |
| | | final LocalizableMessage m = ERR_JEB_COMPSCHEMA_CANNOT_DECODE_OC_TOKEN.get(ae |
| | | .getMessage()); |
| | | throw new InitializationException(m, ae); |
| | | logger.traceException(e); |
| | | throw new InitializationException( |
| | | ERR_JEB_COMPSCHEMA_CANNOT_DECODE_OC_TOKEN.get(e.getMessage()), e); |
| | | } |
| | | finally |
| | | { |
| | |
| | | LockMode.READ_UNCOMMITTED); |
| | | } |
| | | } |
| | | catch (final ASN1Exception ae) |
| | | catch (final IOException e) |
| | | { |
| | | logger.traceException(ae); |
| | | |
| | | final LocalizableMessage m = ERR_JEB_COMPSCHEMA_CANNOT_DECODE_AD_TOKEN.get(ae |
| | | .getMessage()); |
| | | throw new InitializationException(m, ae); |
| | | logger.traceException(e); |
| | | throw new InitializationException( |
| | | ERR_JEB_COMPSCHEMA_CANNOT_DECODE_AD_TOKEN.get(e.getMessage()), e); |
| | | } |
| | | finally |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | if(isUsable) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_INTEGER_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | changeType = PersistentSearchChangeType.valueOf(changeTypeValue); |
| | | |
| | | if(reader.hasNextElement() && |
| | | reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE) |
| | | reader.peekType() == ASN1.UNIVERSAL_OCTET_STRING_TYPE) |
| | | { |
| | | if (changeType != PersistentSearchChangeType.MODIFY_DN) |
| | | { |
| | |
| | | previousDN = DN.valueOf(reader.readOctetStringAsString()); |
| | | } |
| | | if(reader.hasNextElement() && |
| | | reader.peekType() == UNIVERSAL_INTEGER_TYPE) |
| | | reader.peekType() == ASN1.UNIVERSAL_INTEGER_TYPE) |
| | | { |
| | | changeNumber = reader.readInteger(); |
| | | } |
| | |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeEnumerated(changeType.intValue()); |
| | |
| | | package org.opends.server.controls; |
| | | import static org.opends.messages.ProtocolMessages.ERR_ECLN_CANNOT_DECODE_VALUE; |
| | | import static org.opends.messages.ProtocolMessages.ERR_ECLN_NO_CONTROL_VALUE; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.getExceptionMessage; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | |
| | | * @throws IOException If a problem occurs while writing to the stream. |
| | | */ |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(); |
| | | writer.writeOctetString(cookie.toString()); |
| | | writer.writeEndSequence(); |
| | |
| | | */ |
| | | package org.opends.server.controls; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.getExceptionMessage; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.replication.common.MultiDomainServerState; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | |
| | | protected void writeValue(ASN1Writer writer) |
| | | throws IOException |
| | | { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeOctetString(this.cookie.toString()); |
| | | writer.writeEndSequence(); |
| | | } |
| | |
| | | */ |
| | | |
| | | package org.opends.server.controls; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import static org.opends.server.util.ServerConstants.OID_GET_EFFECTIVE_RIGHTS; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.LinkedList; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * This class partially implements the geteffectiverights control as defined |
| | |
| | | public class GetEffectiveRightsRequestControl extends Control |
| | | { |
| | | /** |
| | | * ControlDecoder implentation to decode this control from a ByteString. |
| | | * ControlDecoder implementation to decode this control from a ByteString. |
| | | */ |
| | | private static final class Decoder |
| | | implements ControlDecoder<GetEffectiveRightsRequestControl> |
| | |
| | | reader.readEndSequence(); |
| | | } |
| | | reader.readEndSequence(); |
| | | } catch (ASN1Exception e) { |
| | | } catch (IOException e) { |
| | | logger.traceException(e); |
| | | |
| | | LocalizableMessage message = |
| | |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | if(authzDN != null) |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | rawFilter.write(writer); |
| | | writer.writeEndSequence(); |
| | | } |
| | |
| | | import java.util.Set; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | |
| | | import static org.opends.server.plugins.LDAPADListPlugin.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException |
| | | { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | { |
| | | writer.writeStartSequence(); |
| | | if (rawAttributes != null) |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.protocols.ldap.LDAPReader; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | SearchResultEntryProtocolOp protocolOp = |
| | | new SearchResultEntryProtocolOp(searchEntry); |
| | |
| | | import java.util.Set; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | |
| | | import static org.opends.server.plugins.LDAPADListPlugin.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException |
| | | { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | { |
| | | writer.writeStartSequence(); |
| | | if (rawAttributes != null) |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPReader; |
| | | import org.opends.server.types.*; |
| | |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | SearchResultEntryProtocolOp protocolOp = |
| | | new SearchResultEntryProtocolOp(searchEntry); |
| | |
| | | import java.util.ArrayList; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | for (MatchedValuesFilter f : filters) |
| | |
| | | import org.opends.server.api.OrderingMatchingRule; |
| | | import org.opends.server.api.SubstringMatchingRule; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.forgerock.util.Reject; |
| | | |
| | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.OID_PAGED_RESULTS_CONTROL; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import java.io.IOException; |
| | |
| | | */ |
| | | @Override |
| | | public void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeInteger(size); |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | if (warningType != null) |
| | |
| | | import java.util.Set; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeInteger( |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.PasswordPolicyState; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeOctetString(rawAuthorizationDN); |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.PasswordPolicyState; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | |
| | | |
| | | import org.opends.server.api.OrderingMatchingRule; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | |
| | | private void writeValueFromString(ASN1Writer writer) throws IOException |
| | | { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | for(String[] strs : decodedKeyList) |
| | |
| | | |
| | | private void writeValueFromSortOrder(ASN1Writer writer) throws IOException |
| | | { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | for (SortKey sortKey : sortOrder.getSortKeys()) |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeEnumerated(resultCode); |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException |
| | | { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeBoolean(visibility); |
| | | writer.writeEndSequence(); |
| | | } |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeInteger(beforeCount); |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants. |
| | | UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | writer.writeInteger(targetPosition); |
| | |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.api.CompressedSchema; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (outputStream != null) |
| | | { |
| | | outputStream.close(); |
| | | } |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | } |
| | | close(outputStream); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | } |
| | | reader.readEndSequence(); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | catch (DecodeException e) |
| | | { |
| | | logger.traceException(ae); |
| | | |
| | | LocalizableMessage message = ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION.get( |
| | | ae.getMessage()); |
| | | operation.appendErrorMessage(message); |
| | | logger.traceException(e); |
| | | operation.appendErrorMessage(ERR_GET_SYMMETRIC_KEY_ASN1_DECODE_EXCEPTION.get(e.getMessage())); |
| | | return; |
| | | } |
| | | catch (Exception e) |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | * |
| | | * @return The connection ID decoded from the provided response value. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while trying to decode the |
| | | * @throws DecodeException If an error occurs while trying to decode the |
| | | * response value. |
| | | */ |
| | | public static long decodeResponseValue(ByteString responseValue) |
| | | throws ASN1Exception |
| | | throws DecodeException |
| | | { |
| | | ASN1Reader reader = ASN1.getReader(responseValue); |
| | | try |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | |
| | | { |
| | | responseMessage = reader.readMessage(); |
| | | } |
| | | catch (final ASN1Exception e) |
| | | catch (final DecodeException e) |
| | | { |
| | | // ASN1 layer hides all underlying IO exceptions. |
| | | if (e.getCause() instanceof SocketTimeoutException) |
| | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.PasswordPolicyState; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.schema.AuthPasswordSyntax; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.protocol.OperationContext; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | |
| | | */ |
| | | package org.opends.server.plugins.profiler; |
| | | |
| | | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | |
| | | /** |
| | | * This class defines a data structure that may be used to hold information |
| | |
| | | * information from. |
| | | * |
| | | * @return The decoded profile stack. |
| | | * @throws ASN1Exception If the element could not be decoded for some reason. |
| | | * |
| | | * @throws IOException If the element could not be decoded for some reason. |
| | | */ |
| | | public static ProfileStack decode(ASN1Reader reader) throws ASN1Exception |
| | | public static ProfileStack decode(ASN1Reader reader) throws IOException |
| | | { |
| | | reader.readStartSequence(); |
| | | |
| | |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins.profiler; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.awt.BorderLayout; |
| | | import java.awt.Container; |
| | |
| | | import javax.swing.event.TreeSelectionEvent; |
| | | import javax.swing.event.TreeSelectionListener; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ArgumentParser; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | |
| | | * |
| | | * @throws IOException If a problem occurs while trying to read from the |
| | | * data file. |
| | | * |
| | | * @throws ASN1Exception If an error occurs while trying to decode the |
| | | * contents of the file into profile stack objects. |
| | | */ |
| | | public void processDataFile(String filename) |
| | | throws IOException, ASN1Exception |
| | | public void processDataFile(String filename) throws IOException |
| | | { |
| | | // Try to open the file for reading. |
| | | ASN1Reader reader = ASN1.getReader(new FileInputStream(filename)); |
| | |
| | | */ |
| | | package org.opends.server.plugins.profiler; |
| | | |
| | | |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.protocols.asn1.*; |
| | | |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines a thread that may be used to actually perform |
| | |
| | | { |
| | | // Open the capture file for writing. We'll use an ASN.1 writer to write |
| | | // the data. |
| | | ASN1Writer writer = ASN1.getWriter(new FileOutputStream(filename)); |
| | | FileOutputStream fos = new FileOutputStream(filename); |
| | | ASN1Writer writer = ASN1.getWriter(fos); |
| | | |
| | | |
| | | try |
| | |
| | | finally |
| | | { |
| | | // Make sure to close the file when we're done. |
| | | writer.close(); |
| | | close(writer, fos); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.io.InputStream; |
| | | import java.util.concurrent.ArrayBlockingQueue; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.forgerock.opendj.ldap.ByteSequenceReader; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt |
| | | * or http://forgerock.org/license/CDDLv1.0.html. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at legal-notices/CDDLv1_0.txt. |
| | | * If applicable, add the following below this CDDL HEADER, with the |
| | | * fields enclosed by brackets "[]" replaced with your own identifying |
| | | * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.ldap.ByteSequenceReader; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.channels.IllegalBlockingModeException; |
| | | import java.nio.channels.ReadableByteChannel; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | /** |
| | | * This class is for reading ASN.1 elements from a readable byte |
| | | * channel. It will handle all partial element reads from the channel |
| | | * and save any unread ASN.1 elements if required. All data read from |
| | | * the channel will be ready to be read as ASN.1 elements no matter |
| | | * how many times the channel is read. However, to minimize the the |
| | | * amount of memory used by this reader, the client should read ASN.1 |
| | | * elements as soon as they are read off the channel. |
| | | * <p> |
| | | * {@code ASN1ByteChannelReader}s are created using the factory |
| | | * methods in {@link ASN1}. |
| | | * <p> |
| | | * The client should use this class in the following manner: |
| | | *<p> |
| | | * When NIO signals new data is available in the channel, the client |
| | | * should call {@link #processChannelData()}. |
| | | *<p> |
| | | * If bytes are read from the channel, the client should call |
| | | * {@link #elementAvailable()} to see if a complete element is ready to |
| | | * be read. However, if no data is actually read, the client should |
| | | * wait for the next signal and try again. |
| | | * <p> |
| | | * As long as a complete element is ready, the client should read the |
| | | * appropriate ASN.1 element(s). Once no more complete elements are |
| | | * available, the client should call {@link #processChannelData()} |
| | | * again to read more data (if available). |
| | | * <p> |
| | | * <b>NOTE:</b> Since this reader is non blocking, reading ASN.1 |
| | | * elements before making sure they are ready could result in |
| | | * {@link IllegalBlockingModeException}s being thrown while reading |
| | | * ASN.1 elements. Once an exception is thrown, the state of the reader |
| | | * is no longer stable and can not be used again. |
| | | */ |
| | | final class ASN1ByteChannelReader implements ASN1Reader |
| | | { |
| | | // The byte channel to read from. |
| | | private final ReadableByteChannel byteChannel; |
| | | |
| | | // The wrapped ASN.1 reader. |
| | | private final ASN1Reader reader; |
| | | |
| | | // The NIO ByteStringBuilder that stores any immediate data read off |
| | | // the channel. |
| | | private final ByteBuffer byteBuffer; |
| | | |
| | | // The save buffer used to store any unprocessed data waiting |
| | | // to be read as ASN.1 elements. (Usually due to reading |
| | | // incomplete elements from the channel). |
| | | private final ByteStringBuilder saveBuffer; |
| | | |
| | | // The save buffer reader. |
| | | private final ByteSequenceReader saveBufferReader; |
| | | |
| | | /** |
| | | * An adaptor class for reading from a save buffer and the NIO byte buffer |
| | | * sequentially using the InputStream interface. |
| | | * |
| | | * Since the NIO byte buffer is re-used when reading off the channel, any |
| | | * unused data will be appended to the save buffer before reading off the |
| | | * channel again. This reader will always read the save buffer first before |
| | | * the actual NIO byte buffer to ensure bytes are read in the same order |
| | | * as they are received. |
| | | * |
| | | * The read methods of this stream will throw an IllegalBlockingModeException |
| | | * if invoked when there are no data to read from the save buffer or the |
| | | * channel buffer. |
| | | * |
| | | * The stream will not support the mark or reset methods. |
| | | */ |
| | | private final class CombinedBufferInputStream extends InputStream |
| | | { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int available() |
| | | { |
| | | // The number of available bytes is the sum of the save buffer |
| | | // and the last read data in the NIO ByteStringBuilder. |
| | | return saveBufferReader.remaining() + byteBuffer.remaining(); |
| | | } |
| | | |
| | | /** |
| | | * Reads the next byte of data from the save buffer or channel buffer. |
| | | * The value byte is returned as an int in the range 0 to 255. |
| | | * If no byte is available in the save buffer or channel buffer, |
| | | * IllegalBlockingModeException will be thrown. |
| | | * |
| | | * @return the next byte of data. |
| | | * @throws IllegalBlockingModeException if there are more bytes available. |
| | | */ |
| | | @Override |
| | | public int read() |
| | | { |
| | | if(saveBufferReader.remaining() > 0) |
| | | { |
| | | // Try saved buffer first |
| | | return 0xFF & saveBufferReader.get(); |
| | | } |
| | | if(byteBuffer.remaining() > 0) |
| | | { |
| | | // Must still be on the channel buffer |
| | | return 0xFF & byteBuffer.get(); |
| | | } |
| | | |
| | | throw new IllegalBlockingModeException(); |
| | | } |
| | | |
| | | /** |
| | | * Reads up to len bytes of data from the save buffer or channel buffer |
| | | * into an array of bytes. An attempt is made to read as many as len bytes, |
| | | * but a smaller number may be read. The number of bytes actually read is |
| | | * returned as an integer. |
| | | * |
| | | * If b is null, a NullPointerException is thrown. |
| | | * |
| | | * If the length of b is zero, then no bytes are read and 0 is returned; |
| | | * otherwise, there is an attempt to read at least one byte. If no byte is |
| | | * available in the save buffer or channel buffer, |
| | | * IllegalBlockingModeException will be thrown; otherwise, at least one |
| | | * byte is read and stored into b. |
| | | * |
| | | * The first byte read is stored into element b[0], the next one into |
| | | * b[o1], and so on. The number of bytes read is, at most, equal to the |
| | | * length of b. Let k be the number of bytes actually read; these bytes |
| | | * will be stored in elements b[0] through b[k-1], leaving elements b[k] |
| | | * through b[b.length-1] unaffected. |
| | | * |
| | | * @return the total number of bytes read into the buffer. |
| | | * @throws IllegalBlockingModeException if there are more bytes available. |
| | | */ |
| | | @Override |
| | | public int read(byte[] b) |
| | | { |
| | | return read(b, 0, b.length); |
| | | } |
| | | |
| | | /** |
| | | * Reads up to len bytes of data from the save buffer or channel buffer |
| | | * into an array of bytes. An attempt is made to read as many as len bytes, |
| | | * but a smaller number may be read. The number of bytes actually read is |
| | | * returned as an integer. |
| | | * |
| | | * If b is null, a NullPointerException is thrown. |
| | | * |
| | | * If off is negative, or len is negative, or off+len is greater than the |
| | | * length of the array b, then an IndexOutOfBoundsException is thrown. |
| | | * |
| | | * If len is zero, then no bytes are read and 0 is returned; otherwise, |
| | | * there is an attempt to read at least one byte. If no byte is available |
| | | * in the save buffer or channel buffer, IllegalBlockingModeException will |
| | | * be thrown; otherwise, at least one byte is read and stored into b. |
| | | * |
| | | * The first byte read is stored into element b[off], the next one into |
| | | * b[off+1], and so on. The number of bytes read is, at most, equal to len. |
| | | * Let k be the number of bytes actually read; these bytes will be stored |
| | | * in elements b[off] through b[off+k-1], leaving elements b[off+k] |
| | | * through b[off+len-1] unaffected. |
| | | * |
| | | * In every case, elements b[0] through b[off] and elements b[off+len] |
| | | * through b[b.length-1] are unaffected. |
| | | * |
| | | * @return the total number of bytes read into the buffer. |
| | | * @throws IllegalBlockingModeException if there are more bytes available. |
| | | */ |
| | | @Override |
| | | public int read(byte[] b, int off, int len) |
| | | { |
| | | if ((off < 0) || (len < 0) || (off + len > b.length)) |
| | | { |
| | | throw new IndexOutOfBoundsException(); |
| | | } |
| | | |
| | | if(len == 0) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | int bytesCopied=0; |
| | | int getLen; |
| | | if(saveBufferReader.remaining() > 0) |
| | | { |
| | | // Copy out of the last saved buffer first |
| | | getLen = Math.min(saveBufferReader.remaining(), len); |
| | | saveBufferReader.get(b, off, getLen); |
| | | bytesCopied += getLen; |
| | | } |
| | | if(bytesCopied < len && byteBuffer.remaining() > 0) |
| | | { |
| | | // Copy out of the channel buffer if we haven't got |
| | | // everything we needed. |
| | | getLen = Math.min(byteBuffer.remaining(), len - bytesCopied); |
| | | byteBuffer.get(b, off + bytesCopied, getLen); |
| | | bytesCopied += getLen; |
| | | } |
| | | if(bytesCopied < len) |
| | | { |
| | | throw new IllegalBlockingModeException(); |
| | | } |
| | | |
| | | return bytesCopied; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public long skip(long length) |
| | | { |
| | | int bytesSkipped=0; |
| | | int len; |
| | | if(saveBufferReader.remaining() > 0) |
| | | { |
| | | // Skip in the last saved buffer first |
| | | len = Math.min(saveBufferReader.remaining(), (int)length); |
| | | saveBufferReader.position(saveBufferReader.position() + len); |
| | | bytesSkipped += len; |
| | | } |
| | | if(bytesSkipped < length && byteBuffer.remaining() > 0) |
| | | { |
| | | //Skip in the channel buffer if we haven't skipped enough. |
| | | len = Math.min(byteBuffer.remaining(), (int)length - bytesSkipped); |
| | | byteBuffer.position(byteBuffer.position() + len); |
| | | bytesSkipped += len; |
| | | } |
| | | if(bytesSkipped < length) |
| | | { |
| | | throw new IllegalBlockingModeException(); |
| | | } |
| | | |
| | | return bytesSkipped; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates a new ASN.1 byte channel reader whose source is the |
| | | * provided readable byte channel, having a user defined buffer |
| | | * size, and user defined maximum BER element size. |
| | | * |
| | | * @param channel |
| | | * The readable byte channel to use. |
| | | * @param bufferSize |
| | | * The buffer size to use when reading from the channel. |
| | | * @param maxElementSize |
| | | * The max ASN.1 element size this reader will read. |
| | | */ |
| | | ASN1ByteChannelReader(ReadableByteChannel channel, int bufferSize, |
| | | int maxElementSize) |
| | | { |
| | | this.byteChannel = channel; |
| | | this.byteBuffer = ByteBuffer.allocate(bufferSize); |
| | | this.byteBuffer.flip(); |
| | | this.saveBuffer = new ByteStringBuilder(); |
| | | this.saveBufferReader = saveBuffer.asReader(); |
| | | |
| | | CombinedBufferInputStream bufferStream = new CombinedBufferInputStream(); |
| | | this.reader = ASN1.getReader(bufferStream, maxElementSize); |
| | | } |
| | | |
| | | /** |
| | | * Process any new data on the channel so they can be read as ASN.1 |
| | | * elements. This method should only be called when there are no |
| | | * more complete elements in the reader. Calling this method when |
| | | * there are complete elements still in the reader will result in |
| | | * unnecessary memory allocations to store any unread data. This |
| | | * method will perform the following operations: |
| | | * <ul> |
| | | * <li>Clear the save buffer if everything was read. |
| | | * <li>Append any unread data from the NIO byte buffer to the save |
| | | * buffer. |
| | | * <li>Clear the NIO byte buffer and read from the channel. |
| | | * </ul> |
| | | * |
| | | * @return The number of bytes read from the channel or -1 if |
| | | * channel is closed. |
| | | * @throws IOException |
| | | * If an exception occurs while reading from the channel. |
| | | */ |
| | | public int processChannelData() throws IOException |
| | | { |
| | | // Clear the save buffer if we have read all of it |
| | | if (saveBufferReader.remaining() == 0) |
| | | { |
| | | saveBuffer.clear(); |
| | | saveBufferReader.rewind(); |
| | | } |
| | | |
| | | // Append any unused data in the channel buffer to the save buffer |
| | | if (byteBuffer.remaining() > 0) |
| | | { |
| | | saveBuffer.append(byteBuffer, byteBuffer.remaining()); |
| | | } |
| | | |
| | | byteBuffer.clear(); |
| | | try |
| | | { |
| | | int read = byteChannel.read(byteBuffer); |
| | | return read; |
| | | } |
| | | finally |
| | | { |
| | | // Make sure that the buffer is flipped even if the read fails in order to |
| | | // ensure that subsequent calls which query the remaining data return |
| | | // valid results. |
| | | byteBuffer.flip(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Determines if a complete ASN.1 element is ready to be read from |
| | | * channel. |
| | | * |
| | | * @return <code>true</code> if another complete element is available or |
| | | * <code>false</code> otherwise. |
| | | * @throws IOException If an error occurs while trying to decode |
| | | * an ASN1 element. |
| | | */ |
| | | @Override |
| | | public boolean elementAvailable() throws IOException |
| | | { |
| | | return reader.elementAvailable(); |
| | | } |
| | | |
| | | /** |
| | | * Determines if the channel contains at least one ASN.1 element to be read. |
| | | * |
| | | * @return <code>true</code> if another element is available or |
| | | * <code>false</code> otherwise. |
| | | * @throws IOException If an error occurs while trying to decode |
| | | * an ASN1 element. |
| | | */ |
| | | @Override |
| | | public boolean hasNextElement() throws IOException { |
| | | return reader.hasNextElement(); |
| | | } |
| | | |
| | | /** |
| | | * Returns {@code true} if this ASN.1 reader contains unread data. |
| | | * |
| | | * @return {@code true} if this ASN.1 reader contains unread data. |
| | | */ |
| | | public boolean hasRemainingData() |
| | | { |
| | | return (saveBufferReader.remaining() != 0) || (byteBuffer.remaining() != 0); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int peekLength() throws IOException { |
| | | return reader.peekLength(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public byte peekType() throws IOException { |
| | | return reader.peekType(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean readBoolean() throws IOException { |
| | | return reader.readBoolean(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean readBoolean(byte type) throws IOException { |
| | | return reader.readBoolean(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndExplicitTag() throws IOException { |
| | | // reader.readEndExplicitTag(); // TODO |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void readEndSequence() throws IOException { |
| | | reader.readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void readEndSet() throws IOException { |
| | | reader.readEndSet(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public int readEnumerated() throws IOException { |
| | | return reader.readEnumerated(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int readEnumerated(byte type) throws IOException { |
| | | return reader.readEnumerated(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public long readInteger() throws IOException { |
| | | return reader.readInteger(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long readInteger(byte type) throws IOException { |
| | | return reader.readInteger(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void readNull() throws IOException { |
| | | reader.readNull(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readNull(byte type) throws IOException { |
| | | reader.readNull(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteString readOctetString() throws IOException { |
| | | return reader.readOctetString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString readOctetString(byte type) throws IOException { |
| | | return readOctetString(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ByteStringBuilder readOctetString(ByteStringBuilder buffer) throws IOException { |
| | | return reader.readOctetString(buffer); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteStringBuilder readOctetString(byte type, ByteStringBuilder builder) throws IOException { |
| | | return readOctetString(type, builder); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String readOctetStringAsString() throws IOException { |
| | | return reader.readOctetStringAsString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String readOctetStringAsString(byte type) throws IOException { |
| | | return readOctetStringAsString(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartExplicitTag() throws IOException { |
| | | // reader.readStartExplicitTag();// TODO |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void readStartSequence() throws IOException { |
| | | reader.readStartSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSequence(byte type) throws IOException { |
| | | reader.readStartSequence(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void readStartSet() throws IOException { |
| | | reader.readStartSet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSet(byte type) throws IOException { |
| | | reader.readStartSet(type); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void close() throws IOException { |
| | | reader.close(); |
| | | byteChannel.close(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ASN1Reader skipElement() throws IOException { |
| | | reader.skipElement(); |
| | | return this; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.RawAttribute; |
| | | import org.opends.server.util.Base64; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.AuthenticationType; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.Closeable; |
| | | import java.io.IOException; |
| | | import java.net.InetAddress; |
| | | import java.nio.ByteBuffer; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.opends.server.core.*; |
| | |
| | | import org.opends.server.extensions.RedirectingByteChannel; |
| | | import org.opends.server.extensions.TLSByteChannel; |
| | | import org.opends.server.extensions.TLSCapableConnection; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1ByteChannelReader; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | /** |
| | | * This class defines an LDAP client connection, which is a type of |
| | |
| | | private static final class ConnectionFinalizerJob implements Runnable |
| | | { |
| | | /** The client connection ASN1 reader. */ |
| | | private final ASN1Reader asn1Reader; |
| | | private final ASN1ByteChannelReader asn1Reader; |
| | | |
| | | /** The client connection socket channel. */ |
| | | private final SocketChannel socketChannel; |
| | | |
| | | /** Creates a new connection finalizer job. */ |
| | | private ConnectionFinalizerJob(ASN1Reader asn1Reader, |
| | | private ConnectionFinalizerJob(ASN1ByteChannelReader asn1Reader, |
| | | SocketChannel socketChannel) |
| | | { |
| | | this.asn1Reader = asn1Reader; |
| | |
| | | /** |
| | | * Thread local ASN1Writer and buffer. |
| | | */ |
| | | private static final class ASN1WriterHolder |
| | | private static final class ASN1WriterHolder implements Closeable |
| | | { |
| | | private final ASN1Writer writer; |
| | | private final ByteStringBuilder buffer; |
| | |
| | | this.maxBufferSize = getMaxInternalBufferSize(); |
| | | this.writer = ASN1.getWriter(buffer, maxBufferSize); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() throws IOException |
| | | { |
| | | StaticUtils.close(writer); |
| | | buffer.clearAndTruncate(maxBufferSize, maxBufferSize); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | timeoutClientChannel); |
| | | saslChannel = |
| | | RedirectingByteChannel.getRedirectingByteChannel(tlsChannel); |
| | | this.asn1Reader = |
| | | ASN1.getReader(saslChannel, bufferSize, connectionHandler |
| | | .getMaxRequestSize()); |
| | | this.asn1Reader = new ASN1ByteChannelReader(saslChannel, bufferSize, connectionHandler.getMaxRequestSize()); |
| | | |
| | | if (connectionHandler.useSSL()) |
| | | { |
| | |
| | | // Clear and reset all of the internal buffers ready for the next usage. |
| | | // The ASN1Writer is based on a ByteStringBuilder so closing will cause |
| | | // the internal buffers to be resized if needed. |
| | | close(holder.writer); |
| | | close(holder); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.Control; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.api.ProtocolElement; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.Control; |
| | | |
| | | import static org.opends.server.protocols.ldap.LDAPConstants. |
| | |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | | |
| | | |
| | | /** |
| | | * Utility class used to decode LDAP messages from an ASN1Reader. |
| | | */ |
| | |
| | | } |
| | | } |
| | | } |
| | | catch(ASN1Exception asn1e) |
| | | catch(IOException e) |
| | | { |
| | | logger.traceException(asn1e); |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | try |
| | |
| | | } |
| | | } |
| | | } |
| | | catch(ASN1Exception asn1e) |
| | | catch(IOException e) |
| | | { |
| | | logger.traceException(asn1e); |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | try |
| | |
| | | } |
| | | } |
| | | } |
| | | catch(ASN1Exception asn1e) |
| | | catch(IOException e) |
| | | { |
| | | logger.traceException(asn1e); |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | try |
| | |
| | | try |
| | | { |
| | | if(reader.hasNextElement() && |
| | | reader.peekType() == UNIVERSAL_BOOLEAN_TYPE) |
| | | reader.peekType() == ASN1.UNIVERSAL_BOOLEAN_TYPE) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | if(reader.hasNextElement() && |
| | | reader.peekType() == UNIVERSAL_OCTET_STRING_TYPE) |
| | | reader.peekType() == ASN1.UNIVERSAL_OCTET_STRING_TYPE) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | catch(ASN1Exception asn1e) |
| | | catch(IOException e) |
| | | { |
| | | logger.traceException(asn1e); |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | try |
| | |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1ByteChannelReader; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.LDAPException; |
| | |
| | | { |
| | | try |
| | | { |
| | | ASN1ByteChannelReader asn1Reader = readyConnection.getASN1Reader(); |
| | | ASN1Reader asn1Reader = readyConnection.getASN1Reader(); |
| | | boolean ldapMessageProcessed = false; |
| | | while (true) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | catch (ASN1Exception e) |
| | | catch (DecodeException e) |
| | | { |
| | | logger.traceException(e); |
| | | readyConnection.disconnect(DisconnectReason.PROTOCOL_ERROR, true, |
| | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.RawModification; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | |
| | | import java.io.IOException; |
| | | |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.DereferencePolicy; |
| | | import org.opends.server.types.RawFilter; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.DN; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import java.util.Map; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.AttributeType; |
| | |
| | | import java.util.Iterator; |
| | | import java.io.IOException; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.SearchResultReference; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | |
| | | |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | |
| | | import java.util.concurrent.ConcurrentSkipListMap; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.replication.protocol.ProtocolVersion; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.util.Utils; |
| | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy; |
| | | import org.opends.server.admin.std.server.ExternalChangelogDomainCfg; |
| | |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchListener; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | |
| | | replayErrorMsg = message.toString(); |
| | | updateError(csn); |
| | | } |
| | | } catch (ASN1Exception e) |
| | | } catch (DecodeException e) |
| | | { |
| | | replayErrorMsg = logDecodingOperationError(msg, e); |
| | | } catch (LDAPException e) |
| | |
| | | * |
| | | * @param msg The conflicting Add Operation. |
| | | * |
| | | * @throws ASN1Exception When an encoding error happened manipulating the |
| | | * @throws DecodeException When an encoding error happened manipulating the |
| | | * msg. |
| | | */ |
| | | private void addConflict(AddMsg msg) throws ASN1Exception |
| | | private void addConflict(AddMsg msg) throws DecodeException |
| | | { |
| | | String normalizedDN = msg.getDN().toNormalizedString(); |
| | | |
| | |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.controls.ControlDecoder; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | |
| | | import java.io.IOException; |
| | | |
| | |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.AddOperationBasis; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.replication.common.CSN; |
| | |
| | | @Override |
| | | public AddOperation createOperation( |
| | | InternalClientConnection connection, DN newDN) |
| | | throws LDAPException, ASN1Exception |
| | | throws LDAPException, DecodeException |
| | | { |
| | | List<RawAttribute> attr = decodeRawAttributes(encodedAttributes); |
| | | |
| | |
| | | * |
| | | * @param name The name of the attribute to add. |
| | | * @param value The value of the attribute to add. |
| | | * @throws ASN1Exception When this Msg is not valid. |
| | | * @throws DecodeException When this Msg is not valid. |
| | | */ |
| | | public void addAttribute(String name, String value) |
| | | throws ASN1Exception |
| | | public void addAttribute(String name, String value) throws DecodeException |
| | | { |
| | | ByteStringBuilder byteBuilder = new ByteStringBuilder(); |
| | | byteBuilder.append(encodedAttributes); |
| | |
| | | /** |
| | | * Get the attributes of this add msg. |
| | | * @throws LDAPException In case of LDAP decoding exception |
| | | * @throws ASN1Exception In case of ASN1 decoding exception |
| | | * @throws DecodeException In case of ASN1 decoding exception |
| | | * @return the list of attributes |
| | | */ |
| | | public List<Attribute> getAttributes() throws LDAPException, ASN1Exception |
| | | public List<Attribute> getAttributes() throws LDAPException, DecodeException |
| | | { |
| | | return decodeAttributes(encodedAttributes); |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.replication.common.AssuredMode; |
| | |
| | | * @param conn connection to use when creating the message |
| | | * @return the created Operation |
| | | * @throws LDAPException In case of LDAP decoding exception. |
| | | * @throws ASN1Exception In case of ASN1 decoding exception. |
| | | * @throws IOException In case of ASN1 decoding exception. |
| | | * @throws DataFormatException In case of bad msg format. |
| | | */ |
| | | public Operation createOperation(InternalClientConnection conn) |
| | | throws LDAPException, ASN1Exception, DataFormatException |
| | | throws LDAPException, IOException, DataFormatException |
| | | { |
| | | return createOperation(conn, dn); |
| | | } |
| | |
| | | * @param newDN the DN to use when creating the operation. |
| | | * @return the created Operation. |
| | | * @throws LDAPException In case of LDAP decoding exception. |
| | | * @throws ASN1Exception In case of ASN1 decoding exception. |
| | | * @throws IOException In case of ASN1 decoding exception. |
| | | * @throws DataFormatException In case of bad msg format. |
| | | */ |
| | | public abstract Operation createOperation(InternalClientConnection conn, |
| | | DN newDN) throws LDAPException, ASN1Exception, DataFormatException; |
| | | DN newDN) throws LDAPException, IOException, DataFormatException; |
| | | |
| | | |
| | | // ============ |
| | |
| | | * @param in The provided byte array. |
| | | * @return The list of RawAttribute objects. |
| | | * @throws LDAPException when it occurs. |
| | | * @throws ASN1Exception when it occurs. |
| | | * @throws DecodeException when it occurs. |
| | | */ |
| | | public ArrayList<RawAttribute> decodeRawAttributes(byte[] in) |
| | | throws LDAPException, ASN1Exception |
| | | throws LDAPException, DecodeException |
| | | { |
| | | ArrayList<RawAttribute> rattr = new ArrayList<RawAttribute>(); |
| | | try |
| | |
| | | * @param in The provided byte array. |
| | | * @return The list of Attribute objects. |
| | | * @throws LDAPException when it occurs. |
| | | * @throws ASN1Exception when it occurs. |
| | | * @throws DecodeException when it occurs. |
| | | */ |
| | | public ArrayList<Attribute> decodeAttributes(byte[] in) |
| | | throws LDAPException, ASN1Exception |
| | | throws LDAPException, DecodeException |
| | | { |
| | | ArrayList<Attribute> lattr = new ArrayList<Attribute>(); |
| | | try |
| | |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.plugin.EntryHistorical; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | |
| | | /** |
| | | * This class holds every common code for the modify messages (mod, moddn). |
| | |
| | | /** |
| | | * Get the Modifications associated to the UpdateMsg to the provided value. |
| | | * @throws LDAPException In case of LDAP decoding exception |
| | | * @throws ASN1Exception In case of ASN1 decoding exception |
| | | * @throws IOException In case of ASN1 decoding exception |
| | | * @return the list of modifications |
| | | */ |
| | | public List<Modification> getMods() throws ASN1Exception, LDAPException |
| | | public List<Modification> getMods() throws IOException, LDAPException |
| | | { |
| | | return decodeMods(encodedMods); |
| | | } |
| | |
| | | /** |
| | | * Decode mods from the provided byte array. |
| | | * @param in The provided byte array. |
| | | * @throws ASN1Exception when occurs. |
| | | * @throws IOException when occurs. |
| | | * @throws LDAPException when occurs. |
| | | * @return The decoded mods. |
| | | */ |
| | | protected List<Modification> decodeMods(byte[] in) throws ASN1Exception, |
| | | protected List<Modification> decodeMods(byte[] in) throws IOException, |
| | | LDAPException |
| | | { |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | |
| | | * Decode raw mods from the provided byte array. |
| | | * @param in The provided byte array. |
| | | * @return The decoded mods. |
| | | * @throws ASN1Exception when occurs. |
| | | * @throws IOException when occurs. |
| | | * @throws LDAPException when occurs. |
| | | */ |
| | | protected List<RawModification> decodeRawMods(byte[] in) |
| | | throws LDAPException, ASN1Exception |
| | | throws LDAPException, IOException |
| | | { |
| | | List<RawModification> ldapmods = new ArrayList<RawModification>(); |
| | | ASN1Reader asn1Reader = ASN1.getReader(in); |
| | |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.List; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyDNOperationBasis; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.types.*; |
| | |
| | | */ |
| | | @Override |
| | | public ModifyDNOperation createOperation(InternalClientConnection connection, |
| | | DN newDN) throws LDAPException, ASN1Exception |
| | | DN newDN) throws LDAPException, IOException |
| | | { |
| | | ModifyDNOperation moddn = new ModifyDNOperationBasis(connection, |
| | | InternalClientConnection.nextOperationID(), |
| | |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.List; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.types.*; |
| | |
| | | */ |
| | | @Override |
| | | public ModifyOperation createOperation(InternalClientConnection connection, |
| | | DN newDN) throws LDAPException, ASN1Exception, DataFormatException |
| | | DN newDN) throws LDAPException, IOException, DataFormatException |
| | | { |
| | | if (newDN == null) |
| | | newDN = getDN(); |
| | |
| | | import java.util.Map.Entry; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.common.ServerState; |
| | | import org.forgerock.opendj.ldap.ByteSequenceReader; |
| | |
| | | import java.util.*; |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.replication.common.AssuredMode; |
| | | import org.opends.server.replication.common.ServerStatus; |
| | | import org.forgerock.opendj.ldap.ByteSequenceReader; |
| | |
| | | |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | |
| | | |
| | | /** |
| | |
| | | { |
| | | // Certificate SIGNED SEQUENCE |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // CertificateContent SEQUENCE |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // Optional Version |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == (TYPE_MASK_CONTEXT | TYPE_MASK_CONSTRUCTED)) |
| | | reader.peekType() == (ASN1.TYPE_MASK_CONTEXT | ASN1.TYPE_MASK_CONSTRUCTED)) |
| | | { |
| | | reader.readStartExplicitTag(); |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_INTEGER_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_INTEGER_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // serialNumber |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_INTEGER_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_INTEGER_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // signature AlgorithmIdentifier |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // issuer name (SEQUENCE as of X.501, 9.2) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // validity (SEQUENCE) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // subject name (SEQUENCE as of X.501, 9.2) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // SubjectPublicKeyInfo (SEQUENCE) |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // OPTIONAL issuerUniqueIdentifier |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == (TYPE_MASK_CONTEXT + 1)) |
| | | reader.peekType() == (ASN1.TYPE_MASK_CONTEXT + 1)) |
| | | { |
| | | if (x509Version < 1) |
| | | { |
| | |
| | | |
| | | // OPTIONAL subjectUniqueIdentifier |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == (TYPE_MASK_CONTEXT + 2)) |
| | | reader.peekType() == (ASN1.TYPE_MASK_CONTEXT + 2)) |
| | | { |
| | | if (x509Version < 1) |
| | | { |
| | |
| | | |
| | | // OPTIONAL extensions |
| | | if (reader.hasNextElement() && |
| | | reader.peekType() == ((TYPE_MASK_CONTEXT|TYPE_MASK_CONSTRUCTED) + 3)) |
| | | reader.peekType() == ((ASN1.TYPE_MASK_CONTEXT|ASN1.TYPE_MASK_CONSTRUCTED) + 3)) |
| | | { |
| | | if (x509Version < 2) |
| | | { |
| | |
| | | } |
| | | reader.readStartExplicitTag(); // read Tag |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | // only valid in v3 |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | |
| | | |
| | | // AlgorithmIdentifier SEQUENCE |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_SEQUENCE_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_SEQUENCE_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | |
| | | // ENCRYPTED HASH BIT STRING |
| | | if (!reader.hasNextElement() || |
| | | reader.peekType() != UNIVERSAL_BIT_STRING_TYPE) |
| | | reader.peekType() != ASN1.UNIVERSAL_BIT_STRING_TYPE) |
| | | { |
| | | invalidReason.append(ERR_SYNTAX_CERTIFICATE_NOTVALID.get()); |
| | | return false; |
| | |
| | | } |
| | | // End of the certificate |
| | | } |
| | | catch (ASN1Exception e) |
| | | catch (DecodeException e) |
| | | { |
| | | System.out.println(e.getMessageObject()); |
| | | invalidReason.append(e.getMessageObject()); |
| | | return false; |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | invalidReason.append(e.getMessage()); |
| | | return false; |
| | | } |
| | | |
| | | // The basic structure of the value is an X.509 certificate |
| | | return true; |
| | |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | |
| | | import javax.security.sasl.Sasl; |
| | | import javax.security.sasl.SaslClient; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.Control; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.PasswordReader; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get( |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | | SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get( |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException e) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e)); |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, message, e); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get( |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE |
| | | .get(getExceptionMessage(ae)); |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get( |
| | |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, |
| | | message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get( |
| | | getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get( |
| | |
| | | message); |
| | | } |
| | | } |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get( |
| | |
| | | throw new ClientException( |
| | | LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe); |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get(getExceptionMessage(ae)); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, |
| | | message, ae); |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.controls.LDAPAssertionRequestControl; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.CompareRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | |
| | | protocolOp, controls); |
| | | connection.getLDAPWriter().writeMessage(message); |
| | | responseMessage = connection.getLDAPReader().readMessage(); |
| | | } catch(ASN1Exception ae) |
| | | } catch(DecodeException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | if (!compareOptions.continueOnError()) |
| | |
| | | import java.util.LinkedList; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | { |
| | | connection.getLDAPWriter().writeMessage(message); |
| | | responseMessage = connection.getLDAPReader().readMessage(); |
| | | } catch(ASN1Exception ae) |
| | | } catch(DecodeException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | if (!deleteOptions.continueOnError()) |
| | |
| | | import org.opends.server.controls.ProxiedAuthV2Control; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.plugins.ChangeNumberControlPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | |
| | | controls); |
| | | connection.getLDAPWriter().writeMessage(message); |
| | | responseMessage = connection.getLDAPReader().readMessage(); |
| | | } catch(ASN1Exception ae) |
| | | } catch(DecodeException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | LocalizableMessage message = INFO_OPERATION_FAILED.get(operationType); |
| | |
| | | import org.opends.server.controls.PasswordPolicyErrorType; |
| | | import org.opends.server.controls.PasswordPolicyResponseControl; |
| | | import org.opends.server.controls.PasswordPolicyWarningType; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | |
| | | LocalizableMessage message = ERR_LDAPPWMOD_CANNOT_SEND_PWMOD_REQUEST.get(e); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | |
| | | try |
| | | { |
| | | requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | | new UnbindRequestProtocolOp()); |
| | | writer.writeMessage(requestMessage); |
| | | } |
| | | catch (Exception e2) {} |
| | | |
| | | try |
| | | { |
| | | reader.close(); |
| | | writer.close(); |
| | | } catch (Exception e2) {} |
| | | |
| | | unbind(nextMessageID, writer); |
| | | close(reader, writer); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | LocalizableMessage message = ERR_LDAPPWMOD_CANNOT_READ_PWMOD_RESPONSE.get(e); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | |
| | | try |
| | | { |
| | | requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | | new UnbindRequestProtocolOp()); |
| | | writer.writeMessage(requestMessage); |
| | | } |
| | | catch (Exception e2) {} |
| | | |
| | | try |
| | | { |
| | | reader.close(); |
| | | writer.close(); |
| | | } catch (Exception e2) {} |
| | | |
| | | unbind(nextMessageID, writer); |
| | | close(reader, writer); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | } |
| | | |
| | | try |
| | | { |
| | | requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | | new UnbindRequestProtocolOp()); |
| | | writer.writeMessage(requestMessage); |
| | | } |
| | | catch (Exception e) {} |
| | | |
| | | try |
| | | { |
| | | reader.close(); |
| | | writer.close(); |
| | | } catch (Exception e) {} |
| | | |
| | | unbind(nextMessageID, writer); |
| | | close(reader, writer); |
| | | return resultCode; |
| | | } |
| | | else |
| | |
| | | LocalizableMessage message = ERR_LDAPPWMOD_COULD_NOT_DECODE_RESPONSE_VALUE.get(e); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | |
| | | try |
| | | { |
| | | requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | | new UnbindRequestProtocolOp()); |
| | | writer.writeMessage(requestMessage); |
| | | } |
| | | catch (Exception e2) {} |
| | | |
| | | try |
| | | { |
| | | reader.close(); |
| | | writer.close(); |
| | | } catch (Exception e2) {} |
| | | |
| | | unbind(nextMessageID, writer); |
| | | close(reader, writer); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | // Unbind from the server and close the connection. |
| | | unbind(nextMessageID, writer); |
| | | close(reader, writer); |
| | | return 0; |
| | | } |
| | | |
| | | private static void unbind(AtomicInteger nextMessageID, LDAPWriter writer) |
| | | { |
| | | try |
| | | { |
| | | requestMessage = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | | new UnbindRequestProtocolOp()); |
| | | LDAPMessage requestMessage = new LDAPMessage( |
| | | nextMessageID.getAndIncrement(), new UnbindRequestProtocolOp()); |
| | | writer.writeMessage(requestMessage); |
| | | } |
| | | catch (Exception e) {} |
| | | |
| | | try |
| | | { |
| | | reader.close(); |
| | | writer.close(); |
| | | } catch (Exception e) {} |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.RecordingInputStream; |
| | |
| | | * @throws IOException If a problem occurs while attempting to read from the |
| | | * input stream. |
| | | * |
| | | * @throws ASN1Exception If a problem occurs while attempting to decode the |
| | | * @throws DecodeException If a problem occurs while attempting to decode the |
| | | * data read as an ASN.1 sequence. |
| | | |
| | | * @throws LDAPException If a problem occurs while attempting to decode the |
| | | * LDAP message. |
| | | */ |
| | | public LDAPMessage readMessage() |
| | | throws IOException, ASN1Exception, LDAPException |
| | | throws IOException, DecodeException, LDAPException |
| | | { |
| | | debugInputStream.setRecordingEnabled(logger.isTraceEnabled()); |
| | | |
| | |
| | | import com.forgerock.opendj.cli.IntegerArgument; |
| | | import com.forgerock.opendj.cli.MultiChoiceArgument; |
| | | import com.forgerock.opendj.cli.StringArgument; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.messages.ToolMessages.*; |
| | |
| | | |
| | | } while(opType != OP_TYPE_SEARCH_RESULT_DONE); |
| | | |
| | | } catch(ASN1Exception ae) |
| | | } catch(DecodeException ae) |
| | | { |
| | | logger.traceException(ae); |
| | | throw new IOException(ae.getMessage()); |
| | |
| | | import java.io.PrintStream; |
| | | import java.net.SocketTimeoutException; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.DN; |
| | |
| | | * <br> |
| | | * The code simply checks that the exception corresponds to a client side |
| | | * time out. |
| | | * @param ae the asn1exception that occurred connecting to the server or |
| | | * @param ae the DecodeException that occurred connecting to the server or |
| | | * handling the response from the server. |
| | | * @return the message to be displayed to the user when an exception occurs. |
| | | */ |
| | | public static String getMessageForConnectionException(ASN1Exception ae) |
| | | public static String getMessageForConnectionException(DecodeException ae) |
| | | { |
| | | Throwable cause = ae.getCause(); |
| | | if (cause != null) |
| | |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.tools; |
| | | |
| | | import java.io.BufferedOutputStream; |
| | |
| | | import java.net.Socket; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.types.RecordingOutputStream; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * This class defines a utility that can be used to write LDAP messages over a |
| | |
| | | ByteString bytesRead = debugOutputStream.getRecordedBytes(); |
| | | debugOutputStream.clearRecordedBytes(); |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("bytes written to wire(len="); |
| | | builder.append(bytesRead.length()); |
| | | builder.append("):"); |
| | | builder.append(ServerConstants.EOL); |
| | | builder.append(bytesRead.toHexPlusAsciiString(4)); |
| | | |
| | | logger.trace(builder.toString()); |
| | | logger.trace("bytes written to wire(len=" + bytesRead.length() + "):" |
| | | + ServerConstants.EOL + bytesRead.toHexPlusAsciiString(4)); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void close() |
| | | { |
| | | try |
| | | { |
| | | asn1Writer.close(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | |
| | | if (socket != null) |
| | | { |
| | | try |
| | | { |
| | | socket.close(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | } |
| | | } |
| | | StaticUtils.close(asn1Writer, debugOutputStream); |
| | | StaticUtils.close(socket); |
| | | } |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.admin.AdministrationConnector; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | |
| | | import org.opends.server.loggers.ErrorLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | | |
| | |
| | | * @throws IOException if there is a problem with screen I/O |
| | | * @throws LDAPException if there is a problem getting information |
| | | * out to the directory |
| | | * @throws ASN1Exception if there is a problem with the encoding |
| | | * @throws DecodeException if there is a problem with the encoding |
| | | */ |
| | | private void printSummaryTable() |
| | | throws LDAPException, IOException, ASN1Exception { |
| | | throws LDAPException, IOException, DecodeException { |
| | | List<TaskEntry> entries = taskClient.getTaskEntries(); |
| | | if (entries.size() > 0) { |
| | | TableBuilder table = new TableBuilder(); |
| | |
| | | * @throws IOException if there is a problem with screen I/O |
| | | * @throws LDAPException if there is a problem getting information |
| | | * out to the directory |
| | | * @throws ASN1Exception if there is a problem with the encoding |
| | | * @throws DecodeException if there is a problem with the encoding |
| | | */ |
| | | private Menu<Void> getSummaryMenu() |
| | | throws LDAPException, IOException, ASN1Exception { |
| | | throws LDAPException, IOException, DecodeException { |
| | | List<String> taskIds = new ArrayList<String>(); |
| | | List<Integer> cancelableIndices = new ArrayList<Integer>(); |
| | | List<TaskEntry> entries = taskClient.getTaskEntries(); |
| | |
| | | import javax.net.ssl.SSLException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.admin.AdministrationConnector; |
| | | import org.opends.server.controls.ProxiedAuthV2Control; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | |
| | | import org.opends.server.tools.tasks.TaskTool; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.args.LDAPConnectionArgumentParser; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import com.forgerock.opendj.cli.Argument; |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | |
| | | return LDAPResultCode.CLIENT_SIDE_SERVER_DOWN; |
| | | } |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | err.println(wrapText(ERR_STOPDS_IO_ERROR.get(ioe), MAX_LINE_WIDTH)); |
| | | return LDAPResultCode.CLIENT_SIDE_SERVER_DOWN; |
| | | } |
| | | catch (ASN1Exception ae) |
| | | catch (DecodeException ae) |
| | | { |
| | | LocalizableMessage message = ERR_STOPDS_DECODE_ERROR.get(ae.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return LDAPResultCode.CLIENT_SIDE_DECODING_ERROR; |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | err.println(wrapText(ERR_STOPDS_IO_ERROR.get(ioe), MAX_LINE_WIDTH)); |
| | | return LDAPResultCode.CLIENT_SIDE_SERVER_DOWN; |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | LocalizableMessage message = ERR_STOPDS_DECODE_ERROR.get(le.getMessage()); |
| | |
| | | import org.opends.server.backends.task.FailedDependencyAction; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | |
| | | * @throws IOException if there is a stream communication problem |
| | | * @throws LDAPException if there is a problem getting information |
| | | * out to the directory |
| | | * @throws ASN1Exception if there is a problem with the encoding |
| | | * @throws DecodeException if there is a problem with the encoding |
| | | * @throws TaskClientException if there is a problem with the task entry |
| | | */ |
| | | public synchronized TaskEntry schedule(TaskScheduleInformation information) |
| | | throws LDAPException, IOException, ASN1Exception, TaskClientException |
| | | throws LDAPException, IOException, DecodeException, TaskClientException |
| | | { |
| | | LDAPReader reader = connection.getLDAPReader(); |
| | | LDAPWriter writer = connection.getLDAPWriter(); |
| | |
| | | * @throws IOException if there is a stream communication problem |
| | | * @throws LDAPException if there is a problem getting information |
| | | * out to the directory |
| | | * @throws ASN1Exception if there is a problem with the encoding |
| | | * @throws DecodeException if there is a problem with the encoding |
| | | */ |
| | | public synchronized List<TaskEntry> getTaskEntries() |
| | | throws LDAPException, IOException, ASN1Exception { |
| | | throws LDAPException, IOException, DecodeException { |
| | | List<Entry> entries = new ArrayList<Entry>(); |
| | | |
| | | writeSearch(new SearchRequestProtocolOp( |
| | |
| | | * @throws IOException if there is a stream communication problem |
| | | * @throws LDAPException if there is a problem getting information |
| | | * out to the directory |
| | | * @throws ASN1Exception if there is a problem with the encoding |
| | | * @throws DecodeException if there is a problem with the encoding |
| | | * @throws TaskClientException if there is no task with the requested id |
| | | */ |
| | | public synchronized TaskEntry getTaskEntry(String id) |
| | | throws LDAPException, IOException, ASN1Exception, TaskClientException |
| | | throws LDAPException, IOException, DecodeException, TaskClientException |
| | | { |
| | | Entry entry = null; |
| | | |
| | |
| | | * @throws IOException if there is a stream communication problem |
| | | * @throws LDAPException if there is a problem getting information |
| | | * out to the directory |
| | | * @throws ASN1Exception if there is a problem with the encoding |
| | | * @throws DecodeException if there is a problem with the encoding |
| | | * @throws TaskClientException if there is no task with the requested id |
| | | */ |
| | | public synchronized void cancelTask(String id) |
| | | throws TaskClientException, IOException, ASN1Exception, LDAPException |
| | | throws TaskClientException, IOException, DecodeException, LDAPException |
| | | { |
| | | LDAPReader reader = connection.getLDAPReader(); |
| | | LDAPWriter writer = connection.getLDAPWriter(); |
| | |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.tools.tasks; |
| | | |
| | | import com.forgerock.opendj.cli.Argument; |
| | |
| | | import static org.opends.server.util.StaticUtils.getExceptionMessage; |
| | | import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.opends.server.tools.LDAPConnectionException; |
| | | |
| | |
| | | } |
| | | if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | ret = 1; |
| | | } catch (IOException ioe) { |
| | | LocalizableMessage message = ERR_TASK_TOOL_IO_ERROR.get(ioe); |
| | | } catch (DecodeException ae) { |
| | | LocalizableMessage message = ERR_TASK_TOOL_DECODE_ERROR.get(ae.getMessage()); |
| | | if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | ret = 1; |
| | | } catch (ASN1Exception ae) { |
| | | LocalizableMessage message = ERR_TASK_TOOL_DECODE_ERROR.get(ae.getMessage()); |
| | | } catch (IOException ioe) { |
| | | LocalizableMessage message = ERR_TASK_TOOL_IO_ERROR.get(ioe); |
| | | if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | ret = 1; |
| | | } catch (LDAPException le) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | |
| | | import java.io.IOException; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | |
| | | /** |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | | |
| | | |
| | |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.*; |
| | | import org.opends.server.plugins.InvocationCounterPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.LDAPReader; |
| | | import org.opends.server.replication.common.MultiDomainServerState; |
| | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.opends.server.util.Base64; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.LDAPReader; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.ServerConstants.OID_SERVER_SIDE_SORT_RESPONSE_CONTROL; |
| | | import static org.opends.server.util.ServerConstants.OID_VLV_RESPONSE_CONTROL; |
| | | import static org.testng.Assert.assertEquals; |
| | | import static org.testng.Assert.assertNotNull; |
| | | import static org.testng.Assert.assertNull; |
| | | import static org.testng.Assert.fail; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Constants; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | |
| | | ASN1Reader reader = ASN1.getReader(builder.toByteString()); |
| | | // Should start as an octet string with a nested sequence |
| | | assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | reader.readStartSequence(); |
| | | // Should be an sequence start |
| | | assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_SEQUENCE_TYPE); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_SEQUENCE_TYPE); |
| | | reader.readStartSequence(); |
| | | // Should be an integer with targetPosition |
| | | assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_INTEGER_TYPE); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_INTEGER_TYPE); |
| | | assertEquals(reader.readInteger(), 0); |
| | | // Should be an integer with contentCount |
| | | assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_INTEGER_TYPE); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_INTEGER_TYPE); |
| | | assertEquals(reader.readInteger(), 15); |
| | | // Should be an enumerated with virtualListViewResult |
| | | assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_ENUMERATED_TYPE); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_ENUMERATED_TYPE); |
| | | assertEquals(reader.readEnumerated(), 0); |
| | | // Should be an octet string with contextID |
| | | assertEquals(reader.peekType(), ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | assertEquals(reader.readOctetStringAsString(), "foo"); |
| | | } |
| | | |
| | |
| | | import org.opends.server.controls.MatchedValuesFilter; |
| | | import org.opends.server.controls.SubentriesControl; |
| | | import org.opends.server.plugins.InvocationCounterPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.*; |
| | |
| | | } |
| | | |
| | | private void bindAsManager(LDAPWriter w, org.opends.server.tools.LDAPReader r) |
| | | throws IOException, LDAPException, ASN1Exception, InterruptedException |
| | | throws IOException, LDAPException, DecodeException, InterruptedException |
| | | { |
| | | // Since we are going to be watching the post-response count, we need to |
| | | // wait for the server to become idle before kicking off the next request to |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.plugins.DelayPreOpPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | |
| | | import org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.ConnectionFactory; |
| | | import org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.ConnectionPool; |
| | | import org.opends.server.extensions.LDAPPassThroughAuthenticationPolicyFactory.LDAPConnectionFactory; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.schema.DirectoryStringSyntax; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.tools.LDAPPasswordModify; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.controls.ControlDecoder; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | |
| | | /** |
| | | * This class defines a very simple pre-operation plugin that sleeps for up to |
| | | * five seconds for add, compare, delete, extended, modify, modify DN, and |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeInteger(delayDuration); |
| | | writer.writeEndSequence(); |
| | | } |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.controls.ControlDecoder; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.extensions.ExtensionsConstants; |
| | | import org.opends.server.plugins.SambaPasswordPlugin.TimeStampProvider; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.controls.ControlDecoder; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.*; |
| | | |
| | | |
| | | /** |
| | | * This class defines a very simple plugin that causes request processing to end |
| | | * immediately and send a specific result code to the client. It will be |
| | |
| | | */ |
| | | @Override |
| | | protected void writeValue(ASN1Writer writer) throws IOException { |
| | | writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeStartSequence(); |
| | | writer.writeInteger(resultCode); |
| | | writer.writeOctetString(section); |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt |
| | | * or http://forgerock.org/license/CDDLv1.0.html. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at legal-notices/CDDLv1_0.txt. |
| | | * If applicable, add the following below this CDDL HEADER, with the |
| | | * fields enclosed by brackets "[]" replaced with your own identifying |
| | | * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.protocols.ldap.ASN1ByteChannelReader; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.nio.channels.Channels; |
| | | import java.nio.channels.IllegalBlockingModeException; |
| | | |
| | | /** |
| | | * Test class for ASN1ByteChannelReader |
| | | */ |
| | | public class ASN1ByteChannelReaderTestCase extends ASN1ReaderTestCase |
| | | { |
| | | @Override |
| | | ASN1Reader getReader(byte[] b, int maxElementSize) throws IOException |
| | | { |
| | | ByteArrayInputStream inStream = new ByteArrayInputStream(b); |
| | | ASN1ByteChannelReader reader = |
| | | new ASN1ByteChannelReader(Channels.newChannel(inStream), |
| | | b.length, maxElementSize); |
| | | reader.processChannelData(); |
| | | return reader; |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeShortArrayAsNull() |
| | | throws Exception |
| | | { |
| | | super.testDecodeShortArrayAsNull(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeShortArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | super.testDecodeShortArrayAsInteger(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeShortArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | super.testDecodeShortArrayAsEnumerated(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeShortArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | super.testDecodeShortArrayAsBoolean(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeShortArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | super.testDecodeShortArrayAsOctetString(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array |
| | | * argument with a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeShortArrayAsSequence() |
| | | throws Exception |
| | | { |
| | | super.testDecodeShortArrayAsSequence(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that has less bytes than indicated by the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | super.testDecodeLengthMismatchArrayAsBoolean(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a length mismatch. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | super.testDecodeLengthMismatchArrayAsInteger(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a length mismatch. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | super.testDecodeLengthMismatchArrayAsEnumerated(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using an array whose actual length doesn't match with the decoded length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | super.testDecodeLengthMismatchArrayAsOctetString(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that doesn't contain a full length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | super.testDecodeTruncatedLengthArrayAsBoolean(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a truncated length array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | super.testDecodeTruncatedLengthArrayAsInteger(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a truncated length array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | super.testDecodeTruncatedLengthArrayAsEnumerated(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with an array with a truncated length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsNull() |
| | | throws Exception |
| | | { |
| | | super.testDecodeTruncatedLengthArrayAsNull(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using an array that doesn't fully contain the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | super.testDecodeTruncatedLengthArrayAsOctetString(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array |
| | | * argument with an array that doesn't fully describe the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsSequence() |
| | | throws Exception |
| | | { |
| | | super.testDecodeTruncatedLengthArrayAsSequence(); |
| | | } |
| | | |
| | | /** |
| | | * Tests to make sure a premature EOF while reading a sub sequence can be |
| | | * detected. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testDecodeSequencePrematureEof() |
| | | throws Exception |
| | | { |
| | | super.testDecodeSequencePrematureEof(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>skipElement</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | @Test(expectedExceptions = { IllegalBlockingModeException.class }) |
| | | public void testSkipElementIncompleteRead() |
| | | throws Exception |
| | | { |
| | | super.testSkipElementIncompleteRead(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt |
| | | * or http://forgerock.org/license/CDDLv1.0.html. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at legal-notices/CDDLv1_0.txt. |
| | | * If applicable, add the following below this CDDL HEADER, with the |
| | | * fields enclosed by brackets "[]" replaced with your own identifying |
| | | * information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * An abstract base class for all ASN1Reader test cases. |
| | | */ |
| | | @Test(groups = { "precommit", "asn1" }, sequential = true) |
| | | public abstract class ASN1ReaderTestCase extends DirectoryServerTestCase |
| | | { |
| | | |
| | | /** |
| | | * Retrieves the set of byte array values that may be used for testing. |
| | | * |
| | | * @return The set of byte array values that may be used for testing. |
| | | */ |
| | | @DataProvider(name = "byteValues") |
| | | public Object[][] getByteValues() |
| | | { |
| | | Object[][] array = new Object[256][1]; |
| | | for (int i=0; i < 256; i++) |
| | | { |
| | | array[i] = new Object[] { new byte[] { (byte) (i & 0xFF) } }; |
| | | } |
| | | |
| | | return array; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Create byte arrays with encoded ASN.1 elements to test decoding them as |
| | | * octet strings. |
| | | * |
| | | * @return A list of byte arrays with encoded ASN.1 elements that can be |
| | | * decoded as octet strings. |
| | | */ |
| | | @DataProvider(name = "elementArrays") |
| | | public Object[][] getElementArrays() |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { new byte[] { 0x04, 0x00 } }, |
| | | new Object[] { new byte[] { (byte) 0x50, 0x00 } }, |
| | | new Object[] { new byte[] { 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F } }, |
| | | new Object[] { new byte[] { 0x01, 0x01, 0x00 } }, |
| | | new Object[] { new byte[] { 0x01, 0x01, (byte) 0xFF } }, |
| | | new Object[] { new byte[] { 0x0A, 0x01, 0x00 } }, |
| | | new Object[] { new byte[] { 0x0A, 0x01, 0x01 } }, |
| | | new Object[] { new byte[] { 0x0A, 0x01, 0x7F } }, |
| | | new Object[] { new byte[] { 0x0A, 0x01, (byte) 0x80 } }, |
| | | new Object[] { new byte[] { 0x0A, 0x01, (byte) 0xFF } }, |
| | | new Object[] { new byte[] { 0x0A, 0x02, 0x01, 0x00 } }, |
| | | new Object[] { new byte[] { 0x02, 0x01, 0x00 } }, |
| | | new Object[] { new byte[] { 0x02, 0x01, 0x01 } }, |
| | | new Object[] { new byte[] { 0x02, 0x01, 0x7F } }, |
| | | new Object[] { new byte[] { 0x02, 0x02, 0x00, (byte) 0x80 } }, |
| | | new Object[] { new byte[] { 0x02, 0x02, 0x00, (byte) 0xFF } }, |
| | | new Object[] { new byte[] { 0x02, 0x02, 0x01, 0x00 } }, |
| | | new Object[] { new byte[] { 0x05, 0x00 } }, |
| | | new Object[] { new byte[] { 0x30, 0x00 } }, |
| | | new Object[] { new byte[] { 0x31, 0x00 } }, |
| | | new Object[] { new byte[] { 0x05, (byte) 0x81, 0x00 } }, |
| | | new Object[] { new byte[] { 0x05, (byte) 0x82, 0x00, 0x00 } }, |
| | | new Object[] { new byte[] { 0x05, (byte) 0x83, 0x00, 0x00, 0x00 } }, |
| | | new Object[] { new byte[] { 0x05, (byte) 0x84, 0x00, 0x00, 0x00, 0x00 } }, |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Gets the reader to be use for the unit tests. |
| | | * |
| | | * @param b |
| | | * The array of bytes to be read. |
| | | * @param maxElementSize |
| | | * The max element size. |
| | | * @return The reader to be use for the unit tests. |
| | | * @throws IOException |
| | | * In an unexpected IO exception occurred. |
| | | */ |
| | | abstract ASN1Reader getReader(byte[] b, int maxElementSize) |
| | | throws IOException; |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortArrayAsNull() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[1]; |
| | | getReader(b, 0).readNull(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with an array with a long length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongLengthArrayAsNull() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x05, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| | | getReader(b, 0).readNull(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with an array with a truncated length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsNull() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x05, (byte) 0x82, 0x00 }; |
| | | getReader(b, 0).readNull(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with an arry with a nonzero length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeNonZeroLengthArrayAsNull() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x05, 0x01, 0x00 }; |
| | | getReader(b, 0).readNull(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with an arry with a zero length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testDecodeZeroLengthArrayAsNull() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x05, 0x00 }; |
| | | getReader(b, 0).readNull(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsNull</CODE> method that takes a byte array argument |
| | | * with an arry with a zero length that takes multiple bytes to encode. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testDecodeExtendedZeroLengthArrayAsNull() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x05, (byte) 0x81, 0x00 }; |
| | | getReader(b, 0).readNull(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[0]; |
| | | getReader(b, 0).readInteger(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[0]; |
| | | getReader(b, 0).readEnumerated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a long length array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongLengthArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x02, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 }; |
| | | getReader(b, 0).readInteger(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a long length array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongLengthArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x02, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 }; |
| | | getReader(b, 0).readEnumerated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a truncated length array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x02, (byte) 0x82, 0x00 }; |
| | | getReader(b, 0).readInteger(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a truncated length array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x02, (byte) 0x82, 0x00 }; |
| | | getReader(b, 0).readEnumerated(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsInteger</CODE> method that takes a byte array with |
| | | * a length mismatch. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsInteger() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x02, (byte) 0x81, 0x01 }; |
| | | getReader(b, 0).readInteger(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readEnumerated</CODE> method that takes a byte array with |
| | | * a length mismatch. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsEnumerated() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x02, (byte) 0x81, 0x01 }; |
| | | getReader(b, 0).readEnumerated(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with valid arrays. |
| | | * |
| | | * @param b The byte array to use for the element values. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "byteValues") |
| | | public void testDecodeValidArrayAsBoolean(byte[] b) |
| | | throws Exception |
| | | { |
| | | // First, test with the standard Boolean type. |
| | | byte[] elementArray = new byte[] { 0x01, 0x01, b[0] }; |
| | | assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00)); |
| | | |
| | | |
| | | // Next, test with a nonstandard Boolean type. |
| | | elementArray[0] = (byte) 0x50; |
| | | assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with valid arrays using extended lengths. |
| | | * |
| | | * @param b The byte array to use for the element values. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "byteValues") |
| | | public void testDecodeValidExtendedArrayAsBoolean(byte[] b) |
| | | throws Exception |
| | | { |
| | | // First, test with the standard Boolean type. |
| | | byte[] elementArray = new byte[] { 0x01, (byte) 0x81, 0x01, b[0] }; |
| | | assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00)); |
| | | |
| | | |
| | | // Next, test with a nonstandard Boolean type. |
| | | elementArray[0] = (byte) 0x50; |
| | | assertEquals(getReader(elementArray, 0).readBoolean(), (b[0] != 0x00)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[1]; |
| | | getReader(b, 0).readBoolean(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that takes too many bytes to expressthe length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongLengthArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x01, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 }; |
| | | getReader(b, 0).readBoolean(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that doesn't contain a full length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x01, (byte) 0x82, 0x00 }; |
| | | getReader(b, 0).readBoolean(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that has less bytes than indicated by the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x01, 0x01 }; |
| | | getReader(b, 0).readBoolean(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that has an invalid number of bytes in the value. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortValueArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x01, 0x00, 0x00, 0x00 }; |
| | | getReader(b, 0).readBoolean(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsBoolean</CODE> method that takes a byte array |
| | | * argument with an array that has an invalid number of bytes in the value. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongValueArrayAsBoolean() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x01, 0x02, 0x00, 0x00 }; |
| | | getReader(b, 0).readBoolean(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using a valid array. |
| | | * |
| | | * @param b The byte array to decode. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "elementArrays") |
| | | public void testDecodeValidArrayAsOctetString(byte[] b) |
| | | throws Exception |
| | | { |
| | | ByteStringBuilder bsb = new ByteStringBuilder(); |
| | | bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | bsb.appendBERLength(b.length); |
| | | bsb.append(b); |
| | | |
| | | assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(), |
| | | ByteString.wrap(b)); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetStringAsString</CODE> method that takes a |
| | | * byte array using a valid array. |
| | | * |
| | | * @param b The byte array to decode. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "elementArrays") |
| | | public void testDecodeValidArrayAsOctetStringAsString(byte[] b) |
| | | throws Exception |
| | | { |
| | | ByteStringBuilder bsb = new ByteStringBuilder(); |
| | | bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | bsb.appendBERLength(b.length); |
| | | bsb.append(b); |
| | | |
| | | assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(), |
| | | new String(b, "UTF-8")); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetStringBuilder</CODE> method that takes a |
| | | * byte array using a valid array. |
| | | * |
| | | * @param b The byte array to decode. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "elementArrays") |
| | | public void testDecodeValidArrayAsOctetStringBuilder(byte[] b) |
| | | throws Exception |
| | | { |
| | | ByteStringBuilder bsb = new ByteStringBuilder(); |
| | | bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | bsb.appendBERLength(b.length); |
| | | bsb.append(b); |
| | | |
| | | ByteStringBuilder bsb2 = new ByteStringBuilder(); |
| | | getReader(bsb.toByteArray(), 0).readOctetString(bsb2); |
| | | assertEquals(bsb2.toByteString(), ByteString.wrap(b)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[1]; |
| | | getReader(b, 0).readOctetString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using an array that indicates it takes more than four bytes to encode the |
| | | * length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongLengthArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x04, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| | | getReader(b, 0).readOctetString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using an array that doesn't fully contain the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x04, (byte) 0x82, 0x00 }; |
| | | getReader(b, 0).readOctetString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsOctetString</CODE> method that takes a byte array |
| | | * using an array whose actual length doesn't match with the decoded length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLengthMismatchArrayAsOctetString() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x04, 0x02, 0x00 }; |
| | | getReader(b, 0).readOctetString(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array |
| | | * argument with valid arrays. |
| | | * |
| | | * @param encodedElements Byte arrays that may be used as valid values for |
| | | * encoded elements. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "elementArrays") |
| | | public void testDecodeValidArrayAsSequence(byte[] encodedElements) |
| | | throws Exception |
| | | { |
| | | ByteStringBuilder bsb = new ByteStringBuilder(); |
| | | bsb.append(ASN1.UNIVERSAL_SEQUENCE_TYPE); |
| | | bsb.appendBERLength(encodedElements.length + 2); |
| | | bsb.append(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | bsb.appendBERLength(encodedElements.length); |
| | | bsb.append(encodedElements); |
| | | |
| | | ASN1Reader reader = getReader(bsb.toByteArray(), 0); |
| | | assertEquals(reader.peekLength(), encodedElements.length + 2); |
| | | reader.readStartSequence(); |
| | | assertEquals(reader.peekType(), ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | assertEquals(reader.peekLength(), encodedElements.length); |
| | | reader.readOctetString().equals(ByteString.wrap(encodedElements)); |
| | | reader.readEndSequence(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array |
| | | * argument with a short array. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeShortArrayAsSequence() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[1]; |
| | | getReader(b, 0).readStartSequence(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array |
| | | * argument with an array that takes too many bytes to encode the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeLongLengthArrayAsSequence() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x30, (byte) 0x85, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| | | getReader(b, 0).readStartSequence(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>decodeAsSequence</CODE> method that takes a byte array |
| | | * argument with an array that doesn't fully describe the length. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeTruncatedLengthArrayAsSequence() |
| | | throws Exception |
| | | { |
| | | byte[] b = { 0x30, (byte) 0x82, 0x00 }; |
| | | getReader(b, 0).readStartSequence(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>readOctetString</CODE> method when the max element size |
| | | * is exceeded. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeOctetStringExceedMaxSize() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F }; |
| | | getReader(b, 3).readOctetString(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readOctetString</CODE> method when the max element size |
| | | * is exceeded. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeSequenceExceedMaxSize() |
| | | throws Exception |
| | | { |
| | | byte[] b = new byte[] { 0x30, 0x07, 0x04, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F }; |
| | | getReader(b, 3).readOctetString(); |
| | | } |
| | | |
| | | /** |
| | | * Tests to make sure a premature EOF while reading a sub sequence can be |
| | | * detected. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testDecodeSequencePrematureEof() |
| | | throws Exception |
| | | { |
| | | // An ASN.1 sequence of booleans missing one boolean element at the end |
| | | byte[] b = new byte[] { 0x30, 0x09, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00 }; |
| | | ASN1Reader reader = getReader(b, 0); |
| | | reader.readStartSequence(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | reader.readBoolean(); |
| | | } |
| | | reader.readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * Tests to make sure trailing components are ignored if not used. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testDecodeSequenceIncompleteRead() |
| | | throws Exception |
| | | { |
| | | // An ASN.1 sequence of booleans missing one boolean element at the end |
| | | byte[] b = new byte[] { 0x30, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }; |
| | | ASN1Reader reader = getReader(b, 0); |
| | | reader.readStartSequence(); |
| | | reader.readEndSequence(); |
| | | assertFalse(reader.readBoolean()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>skipElement</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { DecodeException.class }) |
| | | public void testSkipElementIncompleteRead() |
| | | throws Exception |
| | | { |
| | | // An ASN.1 sequence of booleans missing one boolean element at the end |
| | | byte[] b = new byte[] { 0x30, 0x09, 0x01, 0x01, 0x00, 0x01, 0x02 }; |
| | | ASN1Reader reader = getReader(b, 0); |
| | | reader.readStartSequence(); |
| | | reader.readBoolean(); |
| | | reader.skipElement(); |
| | | reader.readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>skipElement</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testSkipElement() |
| | | throws Exception |
| | | { |
| | | // An ASN.1 sequence of booleans missing one boolean element at the end |
| | | byte[] b = new byte[] { 0x30, 0x09, 0x02, 0x01, 0x00, 0x02, 0x01, 0x01, |
| | | 0x02, 0x01, 0x02 }; |
| | | ASN1Reader reader = getReader(b, 0); |
| | | reader.readStartSequence(); |
| | | reader.readInteger(); |
| | | reader.skipElement(); |
| | | assertEquals(reader.readInteger(), 2); |
| | | reader.readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>elementAvailable</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testElementAvailable() |
| | | throws Exception |
| | | { |
| | | // An ASN.1 sequence of booleans missing one boolean element at the end |
| | | byte[] b = new byte[] { 0x30, 0x06, 0x02, 0x01, 0x00, 0x02 }; |
| | | ASN1Reader reader = getReader(b, 0); |
| | | assertFalse(reader.elementAvailable()); |
| | | |
| | | b = new byte[] { 0x30, 0x03, 0x02, 0x01, 0x00 }; |
| | | reader = getReader(b, 0); |
| | | assertTrue(reader.elementAvailable()); |
| | | reader.readStartSequence(); |
| | | assertTrue(reader.elementAvailable()); |
| | | reader.readInteger(); |
| | | assertFalse(reader.elementAvailable()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>hasNextElement</CODE> method. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testHasNextElement() |
| | | throws Exception |
| | | { |
| | | // An ASN.1 sequence of booleans missing one boolean element at the end |
| | | byte[] b = new byte[] { 0x30, 0x06, 0x02, 0x01, 0x00, 0x02, 0x00, 0x03 }; |
| | | ASN1Reader reader = getReader(b, 0); |
| | | assertTrue(reader.hasNextElement()); |
| | | reader.readStartSequence(); |
| | | assertTrue(reader.hasNextElement()); |
| | | reader.readInteger(); |
| | | assertTrue(reader.hasNextElement()); |
| | | |
| | | b = new byte[] { 0x30, 0x03, 0x02, 0x01, 0x00 }; |
| | | reader = getReader(b, 0); |
| | | assertTrue(reader.hasNextElement()); |
| | | reader.readStartSequence(); |
| | | assertTrue(reader.hasNextElement()); |
| | | reader.readInteger(); |
| | | assertFalse(reader.hasNextElement()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>readEndSequence</CODE> method without first calling |
| | | * readStartSequence. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(expectedExceptions = { IllegalStateException.class }) |
| | | public void testReadEndSequenceNoStartSequence() throws Exception |
| | | { |
| | | byte[] b = { 0x30, 0x01, 0x00 }; |
| | | getReader(b, 0).readEndSequence(); |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.testng.annotations.Test; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.OP_TYPE_ABANDON_REQUEST; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import static org.testng.Assert.*; |
| | | |
| | | public class |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.types.LDAPException; |
| | |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.testng.annotations.Test; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | //import org.testng.Reporter; |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.testng.annotations.Test; |
| | | import static org.testng.Assert.assertEquals; |
| | | |
| | |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | |
| | | /** |
| | | * This class defines a set of tests for the |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | import org.testng.annotations.*; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.types.LDAPException; |
| | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import static org.opends.server.util.ServerConstants.EOL; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import static org.opends.server.protocols.asn1.ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE; |
| | | import org.forgerock.opendj.io.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | ASN1Writer writer = ASN1.getWriter(builder); |
| | | writer.writeStartSequence(OP_TYPE_SEARCH_REQUEST); |
| | | writer.writeOctetString(baseDN); |
| | | writer.writeNull(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeNull(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeInteger(dereferencePolicy.intValue()); |
| | | writer.writeInteger(sizeLimit); |
| | | writer.writeInteger(timeLimit); |
| | |
| | | writer.writeStartSequence(OP_TYPE_SEARCH_REQUEST); |
| | | writer.writeOctetString(baseDN); |
| | | writer.writeInteger(scope.intValue()); |
| | | writer.writeNull(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeNull(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeInteger(sizeLimit); |
| | | writer.writeInteger(timeLimit); |
| | | writer.writeBoolean(typesOnly); |
| | |
| | | writer.writeOctetString(baseDN); |
| | | writer.writeInteger(scope.intValue()); |
| | | writer.writeInteger(dereferencePolicy.intValue()); |
| | | writer.writeNull(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeNull(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeInteger(timeLimit); |
| | | writer.writeBoolean(typesOnly); |
| | | filter.write(writer); |
| | |
| | | writer.writeInteger(scope.intValue()); |
| | | writer.writeInteger(dereferencePolicy.intValue()); |
| | | writer.writeInteger(sizeLimit); |
| | | writer.writeNull(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeNull(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeBoolean(typesOnly); |
| | | filter.write(writer); |
| | | |
| | |
| | | writer.writeInteger(dereferencePolicy.intValue()); |
| | | writer.writeInteger(sizeLimit); |
| | | writer.writeInteger(timeLimit); |
| | | writer.writeNull(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeNull(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | filter.write(writer); |
| | | |
| | | writer.writeStartSequence(); |
| | |
| | | writer.writeInteger(sizeLimit); |
| | | writer.writeInteger(timeLimit); |
| | | writer.writeBoolean(typesOnly); |
| | | writer.writeNull(UNIVERSAL_OCTET_STRING_TYPE); |
| | | writer.writeNull(ASN1.UNIVERSAL_OCTET_STRING_TYPE); |
| | | |
| | | writer.writeStartSequence(); |
| | | for(String attribute : attributes) |
| | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.forgerock.opendj.io.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants. |
| | | OP_TYPE_SEARCH_RESULT_ENTRY; |
| | | import static org.testng.Assert.*; |
| | |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | import org.opends.server.protocols.asn1.ASN1Writer; |
| | | import org.opends.server.protocols.asn1.ASN1; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.testng.annotations.Test; |
| | | import static org.testng.Assert.*; |