| | |
| | | */ |
| | | public long getConnectionID() |
| | | { |
| | | |
| | | return connectionID; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ConnectionHandler getConnectionHandler() |
| | | { |
| | | |
| | | return connectionHandler; |
| | | } |
| | | |
| | |
| | | */ |
| | | public LDAPRequestHandler getRequestHandler() |
| | | { |
| | | |
| | | return requestHandler; |
| | | } |
| | | |
| | |
| | | */ |
| | | public void setRequestHandler(LDAPRequestHandler requestHandler) |
| | | { |
| | | |
| | | this.requestHandler = requestHandler; |
| | | } |
| | | |
| | |
| | | */ |
| | | public SocketChannel getSocketChannel() |
| | | { |
| | | |
| | | return clientChannel; |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getProtocol() |
| | | { |
| | | |
| | | return protocol; |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getClientAddress() |
| | | { |
| | | |
| | | return clientAddress; |
| | | } |
| | | |
| | |
| | | */ |
| | | public int getClientPort() |
| | | { |
| | | |
| | | return clientPort; |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getServerAddress() |
| | | { |
| | | |
| | | return serverAddress; |
| | | } |
| | | |
| | |
| | | */ |
| | | public int getServerPort() |
| | | { |
| | | |
| | | return serverPort; |
| | | } |
| | | |
| | |
| | | */ |
| | | public InetAddress getRemoteAddress() |
| | | { |
| | | |
| | | return clientChannel.socket().getInetAddress(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public InetAddress getLocalAddress() |
| | | { |
| | | |
| | | return clientChannel.socket().getLocalAddress(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean isSecure() |
| | | { |
| | | |
| | | return securityProvider.isSecure(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public ConnectionSecurityProvider getConnectionSecurityProvider() |
| | | { |
| | | |
| | | return securityProvider; |
| | | } |
| | | |
| | |
| | | public void setConnectionSecurityProvider(ConnectionSecurityProvider |
| | | securityProvider) |
| | | { |
| | | |
| | | this.securityProvider = securityProvider; |
| | | |
| | | if (securityProvider.isSecure()) |
| | |
| | | */ |
| | | public String getSecurityMechanism() |
| | | { |
| | | |
| | | return securityProvider.getSecurityMechanismName(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public long nextOperationID() |
| | | { |
| | | |
| | | return nextOperationID.getAndIncrement(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public void sendResponse(Operation operation) |
| | | { |
| | | |
| | | LDAPMessage message = operationToResponseLDAPMessage(operation); |
| | | if (message != null) |
| | | { |
| | |
| | | */ |
| | | private LDAPMessage operationToResponseLDAPMessage(Operation operation) |
| | | { |
| | | |
| | | ResultCode resultCode = operation.getResultCode(); |
| | | if (resultCode == null) |
| | | { |
| | |
| | | public void sendSearchEntry(SearchOperation searchOperation, |
| | | SearchResultEntry searchEntry) |
| | | { |
| | | |
| | | SearchResultEntryProtocolOp protocolOp = |
| | | new SearchResultEntryProtocolOp(searchEntry); |
| | | |
| | |
| | | public boolean sendSearchReference(SearchOperation searchOperation, |
| | | SearchResultReference searchReference) |
| | | { |
| | | |
| | | |
| | | // Make sure this is not an LDAPv2 client. If it is, then they can't see |
| | | // referrals so we'll not send anything. Also, throw an exception so that |
| | | // the core server will know not to try sending any more referrals to this |
| | |
| | | protected boolean sendIntermediateResponseMessage( |
| | | IntermediateResponse intermediateResponse) |
| | | { |
| | | |
| | | IntermediateResponseProtocolOp protocolOp = |
| | | new IntermediateResponseProtocolOp(intermediateResponse.getOID(), |
| | | intermediateResponse.getValue()); |
| | |
| | | private void sendLDAPMessage(ConnectionSecurityProvider secProvider, |
| | | LDAPMessage message) |
| | | { |
| | | |
| | | ASN1Element messageElement = message.encode(); |
| | | |
| | | ByteBuffer messageBuffer = ByteBuffer.wrap(messageElement.encode()); |
| | |
| | | boolean sendNotification, String message, |
| | | int messageID) |
| | | { |
| | | |
| | | |
| | | // If we are already in the middle of a disconnect, then don't do anything. |
| | | if (disconnectRequested) |
| | | { |
| | |
| | | */ |
| | | public Collection<Operation> getOperationsInProgress() |
| | | { |
| | | |
| | | return operationsInProgress.values(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public Operation getOperationInProgress(int messageID) |
| | | { |
| | | |
| | | return operationsInProgress.get(messageID); |
| | | } |
| | | |
| | |
| | | public void addOperationInProgress(Operation operation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | int messageID = operation.getMessageID(); |
| | | |
| | | // We need to grab a lock to ensure that no one else can add operations to |
| | |
| | | */ |
| | | public boolean removeOperationInProgress(int messageID) |
| | | { |
| | | |
| | | Operation operation = operationsInProgress.remove(messageID); |
| | | return (operation != null); |
| | | } |
| | |
| | | public CancelResult cancelOperation(int messageID, |
| | | CancelRequest cancelRequest) |
| | | { |
| | | |
| | | Operation op = operationsInProgress.get(messageID); |
| | | if (op == null) |
| | | { |
| | |
| | | */ |
| | | public void cancelAllOperations(CancelRequest cancelRequest) |
| | | { |
| | | |
| | | |
| | | // Make sure that no one can add any new operations. |
| | | opsInProgressLock.lock(); |
| | | |
| | |
| | | public void cancelAllOperationsExcept(CancelRequest cancelRequest, |
| | | int messageID) |
| | | { |
| | | |
| | | |
| | | // Make sure that no one can add any new operations. |
| | | opsInProgressLock.lock(); |
| | | |
| | |
| | | */ |
| | | private boolean processLDAPMessage(LDAPMessage message) |
| | | { |
| | | |
| | | |
| | | if (keepStats) |
| | | { |
| | | statTracker.updateMessageRead(message); |
| | |
| | | private boolean processAbandonRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | AbandonRequestProtocolOp protocolOp = message.getAbandonRequestProtocolOp(); |
| | | AbandonOperation abandonOp = |
| | | new AbandonOperation(this, nextOperationID.getAndIncrement(), |
| | |
| | | private boolean processAddRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | // Create the add operation and add it into the work queue. |
| | | AddRequestProtocolOp protocolOp = message.getAddRequestProtocolOp(); |
| | | AddOperation addOp = |
| | |
| | | private boolean processBindRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | BindRequestProtocolOp protocolOp = message.getBindRequestProtocolOp(); |
| | | |
| | | // See if this is an LDAPv2 bind request, and if so whether that should be |
| | |
| | | private boolean processCompareRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | CompareRequestProtocolOp protocolOp = message.getCompareRequestProtocolOp(); |
| | | CompareOperation compareOp = |
| | | new CompareOperation(this, nextOperationID.getAndIncrement(), |
| | |
| | | private boolean processDeleteRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | DeleteRequestProtocolOp protocolOp = message.getDeleteRequestProtocolOp(); |
| | | DeleteOperation deleteOp = |
| | | new DeleteOperation(this, nextOperationID.getAndIncrement(), |
| | |
| | | private boolean processExtendedRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | // See if this is an LDAPv2 client. If it is, then they should not be |
| | | // issuing extended requests. We can't send a response that we can be sure |
| | | // they can understand, so we have no choice but to close the connection. |
| | |
| | | private boolean processModifyRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | ModifyRequestProtocolOp protocolOp = message.getModifyRequestProtocolOp(); |
| | | ModifyOperation modifyOp = |
| | | new ModifyOperation(this, nextOperationID.getAndIncrement(), |
| | |
| | | private boolean processModifyDNRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | ModifyDNRequestProtocolOp protocolOp = |
| | | message.getModifyDNRequestProtocolOp(); |
| | | ModifyDNOperation modifyDNOp = |
| | |
| | | private boolean processSearchRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | SearchRequestProtocolOp protocolOp = message.getSearchRequestProtocolOp(); |
| | | SearchOperation searchOp = |
| | | new SearchOperation(this, nextOperationID.getAndIncrement(), |
| | |
| | | private boolean processUnbindRequest(LDAPMessage message, |
| | | ArrayList<Control> controls) |
| | | { |
| | | |
| | | |
| | | UnbindOperation unbindOp = |
| | | new UnbindOperation(this, nextOperationID.getAndIncrement(), |
| | | message.getMessageID(), controls); |
| | |
| | | */ |
| | | public String getMonitorSummary() |
| | | { |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | buffer.append("connID=\""); |
| | | buffer.append(connectionID); |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | |
| | | buffer.append("LDAP client connection from "); |
| | | buffer.append(clientAddress); |
| | | buffer.append(":"); |
| | |
| | | */ |
| | | public boolean tlsProtectionAvailable(StringBuilder unavailableReason) |
| | | { |
| | | |
| | | |
| | | // Make sure that this client connection does not already have some other |
| | | // security provider enabled. |
| | | if (! (securityProvider instanceof NullConnectionSecurityProvider)) |
| | |
| | | public void enableTLSConnectionSecurityProvider() |
| | | throws DirectoryException |
| | | { |
| | | |
| | | if (tlsSecurityProvider == null) |
| | | { |
| | | int msgID = MSGID_LDAP_TLS_NO_PROVIDER; |
| | |
| | | public void disableTLSConnectionSecurityProvider() |
| | | throws DirectoryException |
| | | { |
| | | |
| | | int msgID = MSGID_LDAP_TLS_CLOSURE_NOT_ALLOWED; |
| | | String message = getMessage(msgID); |
| | | |
| | |
| | | public void sendClearResponse(Operation operation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | if (clearSecurityProvider == null) |
| | | { |
| | | int msgID = MSGID_LDAP_NO_CLEAR_SECURITY_PROVIDER; |
| | |
| | | */ |
| | | public DN getKeyManagerProviderDN() |
| | | { |
| | | |
| | | return connectionHandler.getKeyManagerProviderDN(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public DN getTrustManagerProviderDN() |
| | | { |
| | | |
| | | return connectionHandler.getTrustManagerProviderDN(); |
| | | } |
| | | |