Update the server to provide better interoperability with the Penrose virtual
directory. In particular, this commit exposes the
LDAPClientConnection.sendLDAPMessage() method, and fixes a case in which
short-circuiting out of the add operation processing in the pre-parse code with
a success response could have resulted in a null pointer exception.
OpenDS Issue Number: 1729
| | |
| | | |
| | | // Notify any change notification listeners that might be registered with |
| | | // the server. |
| | | if (getResultCode() == ResultCode.SUCCESS) |
| | | if ((getResultCode() == ResultCode.SUCCESS) && (entry != null)) |
| | | { |
| | | for (ChangeNotificationListener changeListener : |
| | | DirectoryServer.getChangeNotificationListeners()) |
| | |
| | | |
| | | |
| | | // Notify any persistent searches that might be registered with the server. |
| | | if (getResultCode() == ResultCode.SUCCESS) |
| | | if ((getResultCode() == ResultCode.SUCCESS) && (entry != null)) |
| | | { |
| | | for (PersistentSearch persistentSearch : |
| | | DirectoryServer.getPersistentSearches()) |
| | |
| | | /** |
| | | * Sends the provided LDAP message to the client. |
| | | * |
| | | * @param securityProvider The connection security provider to use to |
| | | * handle any necessary security translation. |
| | | * @param message The LDAP message to send to the client. |
| | | * @param secProvider The connection security provider to use to handle any |
| | | * necessary security translation. |
| | | * @param message The LDAP message to send to the client. |
| | | */ |
| | | private void sendLDAPMessage(ConnectionSecurityProvider secProvider, |
| | | LDAPMessage message) |
| | | public void sendLDAPMessage(ConnectionSecurityProvider secProvider, |
| | | LDAPMessage message) |
| | | { |
| | | ASN1Element messageElement = message.encode(); |
| | | |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1Element; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | |
| | | |
| | | assertFalse(LDAPModify.mainModify(args, false, null, null) == 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the behavior of the server when short-circuiting out of an add |
| | | * operation in the pre-parse phase with a success result code. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testShortCircuitInPreParse() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | List<Control> controls = |
| | | ShortCircuitPlugin.createShortCircuitControlList(0, "PreParse"); |
| | | |
| | | ArrayList<ByteString> ocValues = new ArrayList<ByteString>(); |
| | | ocValues.add(new ASN1OctetString("top")); |
| | | ocValues.add(new ASN1OctetString("organization")); |
| | | |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<RawAttribute>(); |
| | | rawAttrs.add(RawAttribute.create("objectClass", ocValues)); |
| | | rawAttrs.add(RawAttribute.create("o", "test")); |
| | | |
| | | AddOperation addOperation = |
| | | new AddOperation(conn, conn.nextOperationID(), conn.nextMessageID(), |
| | | controls, new ASN1OctetString("o=test"), rawAttrs); |
| | | addOperation.run(); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | | |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1Element; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.protocols.asn1.ASN1Reader; |
| | |
| | | assertEquals(changeListener.getDeleteCount(), 0); |
| | | DirectoryServer.deregisterChangeNotificationListener(changeListener); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the behavior of the server when short-circuiting out of a delete |
| | | * operation in the pre-parse phase with a success result code. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testShortCircuitInPreParse() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | List<Control> controls = |
| | | ShortCircuitPlugin.createShortCircuitControlList(0, "PreParse"); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | new DeleteOperation(conn, conn.nextOperationID(), conn.nextMessageID(), |
| | | controls, new ASN1OctetString("o=test")); |
| | | deleteOperation.run(); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1Element; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | |
| | | |
| | | assertFalse(LDAPModify.mainModify(args, false, null, null) == 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the behavior of the server when short-circuiting out of a modify |
| | | * operation in the pre-parse phase with a success result code. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testShortCircuitInPreParse() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | List<Control> controls = |
| | | ShortCircuitPlugin.createShortCircuitControlList(0, "PreParse"); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "description", |
| | | "foo")); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | new ModifyOperation(conn, conn.nextOperationID(), conn.nextMessageID(), |
| | | controls, new ASN1OctetString("o=test"), mods); |
| | | modifyOperation.run(); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.getEntry(DN.decode("o=test")).hasAttribute( |
| | | DirectoryServer.getAttributeType("description", true))); |
| | | } |
| | | } |
| | | |