Module jcifs

Class DcerpcHandle

java.lang.Object
org.codelibs.jcifs.smb1.dcerpc.DcerpcHandle
All Implemented Interfaces:
DcerpcConstants
Direct Known Subclasses:
DcerpcPipeHandle

public abstract class DcerpcHandle extends Object implements DcerpcConstants
Abstract base class for DCERPC handles providing core RPC functionality. This class manages DCE/RPC protocol bindings and communications over SMB transport.
  • Field Details

    • binding

      protected DcerpcBinding binding
      The DCERPC binding configuration for this handle
    • max_xmit

      protected int max_xmit
      Maximum transmit buffer size for DCERPC messages
    • max_recv

      protected int max_recv
      Maximum receive buffer size for DCERPC messages
    • state

      protected int state
      The current state of the DCERPC connection
    • securityProvider

      protected DcerpcSecurityProvider securityProvider
      The security provider for authentication and message protection
  • Constructor Details

    • DcerpcHandle

      protected DcerpcHandle()
      Default constructor for DcerpcHandle. Initializes the DCE/RPC handle for protocol operations.
  • Method Details

    • parseBinding

      protected static DcerpcBinding parseBinding(String str) throws DcerpcException
      Parses a DCERPC binding string into a DcerpcBinding object
      Parameters:
      str - the binding string to parse
      Returns:
      the parsed DcerpcBinding object
      Throws:
      DcerpcException - if the binding string is malformed
    • getHandle

      Gets a DCERPC handle for the specified URL and authentication
      Parameters:
      url - the DCERPC URL to connect to
      auth - the NTLM authentication credentials
      Returns:
      a DCERPC handle for the connection
      Throws:
      UnknownHostException - if the host cannot be resolved
      MalformedURLException - if the URL is malformed
      DcerpcException - if DCERPC initialization fails
    • bind

      public void bind() throws DcerpcException, IOException
      Binds this handle to the remote DCERPC endpoint
      Throws:
      DcerpcException - if the bind operation fails
      IOException - if an I/O error occurs
    • sendrecv

      public void sendrecv(DcerpcMessage msg) throws DcerpcException, IOException
      Sends a DCERPC message and receives the response
      Parameters:
      msg - the message to send
      Throws:
      DcerpcException - if the RPC operation fails
      IOException - if an I/O error occurs
    • setDcerpcSecurityProvider

      public void setDcerpcSecurityProvider(DcerpcSecurityProvider securityProvider)
      Sets the security provider for this handle
      Parameters:
      securityProvider - the security provider to use
    • getServer

      public String getServer()
      Gets the server hostname or address
      Returns:
      the server name
    • getPrincipal

      public Principal getPrincipal()
      Gets the principal associated with this handle
      Returns:
      the principal or null if not authenticated
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • doSendFragment

      protected abstract void doSendFragment(byte[] buf, int off, int length, boolean isDirect) throws IOException
      Sends a DCERPC fragment to the remote endpoint
      Parameters:
      buf - the buffer containing the fragment
      off - the offset into the buffer
      length - the length of data to send
      isDirect - whether to use direct transmission
      Throws:
      IOException - if an I/O error occurs
    • doReceiveFragment

      protected abstract void doReceiveFragment(byte[] buf, boolean isDirect) throws IOException
      Receives a DCERPC fragment from the remote endpoint
      Parameters:
      buf - the buffer to receive the fragment
      isDirect - whether to use direct reception
      Throws:
      IOException - if an I/O error occurs
    • close

      public abstract void close() throws IOException
      Closes this DCERPC handle and releases resources
      Throws:
      IOException - if an I/O error occurs during close