Exemple #1
0
 public SMBServer(SMBShareCollection shares, GSSProvider securityProvider)
 {
     m_shares            = shares;
     m_securityProvider  = securityProvider;
     m_services          = new NamedPipeShare(shares.ListShares());
     m_serverGuid        = Guid.NewGuid();
     m_connectionManager = new ConnectionManager();
 }
Exemple #2
0
        public SMBServer(ShareCollection shares, IPAddress serverAddress, SMBTransportType transport)
        {
            m_shares        = shares;
            m_serverAddress = serverAddress;
            m_serverGuid    = Guid.NewGuid();
            m_transport     = transport;

            m_services = new NamedPipeShare(shares.ListShares());
        }
Exemple #3
0
        internal static TransactionTransactNamedPipeResponse GetSubcommandResponse(SMBHeader header, TransactionTransactNamedPipeRequest subcommand, NamedPipeShare share, StateObject state)
        {
            string openedFilePath = state.GetOpenedFilePath(subcommand.FID);

            if (openedFilePath == null)
            {
                header.Status = NTStatus.STATUS_INVALID_HANDLE;
                return(null);
            }

            TransactionTransactNamedPipeResponse response = new TransactionTransactNamedPipeResponse();
            RemoteService service = share.GetService(openedFilePath);

            if (service != null)
            {
                RPCPDU rpcRequest = RPCPDU.GetPDU(subcommand.WriteData);
                RPCPDU rpcReply   = RemoteServiceHelper.GetRPCReply(rpcRequest, service);
                response.ReadData = rpcReply.GetBytes();
                return(response);
            }

            // This code should not execute unless the request sequence is invalid
            header.Status = NTStatus.STATUS_INVALID_SMB;
            return(null);
        }