예제 #1
0
  /**
   * Process an IPC$ transaction request.
   *
   * @param vc VirtualCircuit
   * @param tbuf SrvTransactBuffer
   * @param sess SMBSrvSession
   * @param smbPkt SMBSrvPacket
   */
  protected static void procTransaction(
      VirtualCircuit vc, SrvTransactBuffer tbuf, SMBSrvSession sess, SMBSrvPacket smbPkt)
      throws IOException, SMBSrvException {

    // Debug

    if (Debug.EnableInfo && sess.hasDebug(SMBSrvSession.DBG_IPC))
      sess.debugPrintln(
          "IPC$ Transaction  pipe="
              + tbuf.getName()
              + ", subCmd="
              + NamedPipeTransaction.getSubCommand(tbuf.getFunction()));

    // Call the required transaction handler

    if (tbuf.getName().compareTo(TransactionNames.PipeLanman) == 0) {

      // Call the \PIPE\LANMAN transaction handler to process the request

      if (PipeLanmanHandler.processRequest(tbuf, sess, smbPkt)) return;
    }

    // Process the pipe command

    switch (tbuf.getFunction()) {

        // Set named pipe handle state

      case NamedPipeTransaction.SetNmPHandState:
        procSetNamedPipeHandleState(sess, vc, tbuf, smbPkt);
        break;

        // Named pipe transation request, pass the request to the DCE/RPC handler

      case NamedPipeTransaction.TransactNmPipe:
        DCERPCHandler.processDCERPCRequest(sess, vc, tbuf, smbPkt);
        break;

        // Query file information via handle

      case PacketType.Trans2QueryFile:
        procTrans2QueryFile(sess, vc, tbuf, smbPkt);
        break;

        // Unknown command

      default:
        sess.sendErrorResponseSMB(smbPkt, SMBStatus.SRVUnrecognizedCommand, SMBStatus.ErrSrv);
        break;
    }
  }