Renamed SMBCommand to SMB1Command

This commit is contained in:
Tal Aloni 2017-01-10 11:02:20 +02:00
parent f340094946
commit 8b7d8b289b
60 changed files with 93 additions and 93 deletions

View file

@ -38,7 +38,7 @@ namespace SMBLibrary.Client
TrySendMessage(serverSocket, request);
}
public static void TrySendMessage(Socket serverSocket, SMBCommand request)
public static void TrySendMessage(Socket serverSocket, SMB1Command request)
{
SMBMessage message = new SMBMessage();
message.Commands.Add(request);

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_CHECK_DIRECTORY Request
/// </summary>
public class CheckDirectoryRequest : SMBCommand
public class CheckDirectoryRequest : SMB1Command
{
public const byte SupportedBufferFormat = 0x04;
// Data:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_CHECK_DIRECTORY Response
/// </summary>
public class CheckDirectoryResponse : SMBCommand
public class CheckDirectoryResponse : SMB1Command
{
public CheckDirectoryResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_CLOSE Request
/// </summary>
public class CloseRequest : SMBCommand
public class CloseRequest : SMB1Command
{
public const int ParametersLength = 6;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_CLOSE Response
/// </summary>
public class CloseResponse : SMBCommand
public class CloseResponse : SMB1Command
{
public CloseResponse() : base()
{}

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// This command is obsolete.
/// This command is used by Windows NT4 SP6.
/// </summary>
public class CreateDirectoryRequest : SMBCommand
public class CreateDirectoryRequest : SMB1Command
{
public const byte SupportedBufferFormat = 0x04;
// Data:

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// This command is obsolete.
/// This command is used by Windows NT4 SP6.
/// </summary>
public class CreateDirectoryResponse : SMBCommand
public class CreateDirectoryResponse : SMB1Command
{
public CreateDirectoryResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_DELETE_DIRECTORY Request
/// </summary>
public class DeleteDirectoryRequest : SMBCommand
public class DeleteDirectoryRequest : SMB1Command
{
public const int SupportedBufferFormat = 0x04;
// Data:

View file

@ -13,7 +13,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_DELETE_DIRECTORY Response
/// </summary>
public class DeleteDirectoryResponse : SMBCommand
public class DeleteDirectoryResponse : SMB1Command
{
public DeleteDirectoryResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_DELETE Request
/// </summary>
public class DeleteRequest : SMBCommand
public class DeleteRequest : SMB1Command
{
public const int SupportedBufferFormat = 0x04;
public const int ParametersLength = 2;

View file

@ -13,7 +13,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_DELETE Response
/// </summary>
public class DeleteResponse : SMBCommand
public class DeleteResponse : SMB1Command
{
public DeleteResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_ECHO
/// </summary>
public class EchoRequest : SMBCommand
public class EchoRequest : SMB1Command
{
public const int ParametersLength = 1;
// Parameters

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_ECHO
/// </summary>
public class EchoResponse : SMBCommand
public class EchoResponse : SMB1Command
{
public const int ParametersLength = 2;
// Parameters

View file

@ -15,7 +15,7 @@ namespace SMBLibrary.SMB1
/// The Command trailer of an error response message.
/// See [MS-CIFS]3.3.4.1.2 - Sending Any Error Response Message.
/// </summary>
public class ErrorResponse : SMBCommand
public class ErrorResponse : SMB1Command
{
private CommandName m_commandName;

View file

@ -8,7 +8,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_FIND_CLOSE2 Request
/// </summary>
public class FindClose2Request : SMBCommand
public class FindClose2Request : SMB1Command
{
public const int ParameterCount = 2;
// Parameters:

View file

@ -8,7 +8,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_FIND_CLOSE2 Response
/// </summary>
public class FindClose2Response : SMBCommand
public class FindClose2Response : SMB1Command
{
public FindClose2Response() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_FLUSH Request
/// </summary>
public class FlushRequest : SMBCommand
public class FlushRequest : SMB1Command
{
public const int ParametersLength = 2;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_FLUSH Response
/// </summary>
public class FlushResponse : SMBCommand
public class FlushResponse : SMB1Command
{
public FlushResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NT_TRANSACT Interim Response
/// </summary>
public class NTTransactInterimResponse : SMBCommand
public class NTTransactInterimResponse : SMB1Command
{
public const int ParametersLength = 0;

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NT_TRANSACT Request
/// </summary>
public class NTTransactRequest : SMBCommand
public class NTTransactRequest : SMB1Command
{
public const int FixedSMBParametersLength = 38;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NT_TRANSACT Response
/// </summary>
public class NTTransactResponse : SMBCommand
public class NTTransactResponse : SMB1Command
{
public const int FixedSMBParametersLength = 36;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NT_TRANSACT_SECONDARY Request
/// </summary>
public class NTTransactSecondaryRequest : SMBCommand
public class NTTransactSecondaryRequest : SMB1Command
{
public const int SMBParametersLength = 36;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NEGOTIATE Request
/// </summary>
public class NegotiateRequest : SMBCommand
public class NegotiateRequest : SMB1Command
{
public const int SupportedBufferFormat = 0x02;
// Data:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NEGOTIATE Response, NT LAN Manager dialect
/// </summary>
public class NegotiateResponseNTLM : SMBCommand
public class NegotiateResponseNTLM : SMB1Command
{
public const int ParametersLength = 34;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NEGOTIATE Response, NT LAN Manager dialect, Extended Security response
/// </summary>
public class NegotiateResponseNTLMExtended : SMBCommand
public class NegotiateResponseNTLMExtended : SMB1Command
{
public const int ParametersLength = 34;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_NEGOTIATE Response
/// </summary>
public class NegotiateResponseNotSupported : SMBCommand
public class NegotiateResponseNotSupported : SMB1Command
{
public const int ParametersLength = 2;
public const ushort DialectsNotSupported = 0xFFFF;

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// This command is deprecated.
/// This command is used by Windows NT4 SP6.
/// </summary>
public class QueryInformationRequest : SMBCommand
public class QueryInformationRequest : SMB1Command
{
public const byte SupportedBufferFormat = 0x04;
// Data:

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// This command is deprecated.
/// This command is used by Windows NT4 SP6.
/// </summary>
public class QueryInformationResponse : SMBCommand
public class QueryInformationResponse : SMB1Command
{
public const int ParameterLength = 20;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_READ Request
/// </summary>
public class ReadRequest : SMBCommand
public class ReadRequest : SMB1Command
{
public const int ParametersLength = 10;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_READ Response
/// </summary>
public class ReadResponse : SMBCommand
public class ReadResponse : SMB1Command
{
public const int ParametersLength = 10;
public const int SupportedBufferFormat = 0x01;

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_RENAME Request
/// </summary>
public class RenameRequest : SMBCommand
public class RenameRequest : SMB1Command
{
public const int SupportedBufferFormat = 0x04;
public const int ParametersLength = 2;

View file

@ -13,7 +13,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_RENAME Response
/// </summary>
public class RenameResponse : SMBCommand
public class RenameResponse : SMB1Command
{
public RenameResponse() : base()
{

View file

@ -11,18 +11,18 @@ using Utilities;
namespace SMBLibrary.SMB1
{
public abstract class SMBCommand
public abstract class SMB1Command
{
public byte[] SMBParameters; // SMB_Parameters
public byte[] SMBData; // SMB_Data
public SMBCommand()
public SMB1Command()
{
SMBParameters = new byte[0];
SMBData = new byte[0];
}
public SMBCommand(byte[] buffer, int offset, bool isUnicode)
public SMB1Command(byte[] buffer, int offset, bool isUnicode)
{
byte wordCount = ByteReader.ReadByte(buffer, ref offset);
SMBParameters = ByteReader.ReadBytes(buffer, ref offset, wordCount * 2);
@ -63,7 +63,7 @@ namespace SMBLibrary.SMB1
return buffer;
}
public static SMBCommand ReadCommand(byte[] buffer, int offset, CommandName commandName, SMBHeader header)
public static SMB1Command ReadCommand(byte[] buffer, int offset, CommandName commandName, SMBHeader header)
{
if ((header.Flags & HeaderFlags.Reply) > 0)
{
@ -75,7 +75,7 @@ namespace SMBLibrary.SMB1
}
}
public static SMBCommand ReadCommandRequest(byte[] buffer, int offset, CommandName commandName, bool isUnicode)
public static SMB1Command ReadCommandRequest(byte[] buffer, int offset, CommandName commandName, bool isUnicode)
{
switch (commandName)
{
@ -160,7 +160,7 @@ namespace SMBLibrary.SMB1
}
}
public static SMBCommand ReadCommandResponse(byte[] buffer, int offset, CommandName commandName, bool isUnicode)
public static SMB1Command ReadCommandResponse(byte[] buffer, int offset, CommandName commandName, bool isUnicode)
{
byte wordCount = ByteReader.ReadByte(buffer, offset);
switch (commandName)

View file

@ -11,7 +11,7 @@ using Utilities;
namespace SMBLibrary.SMB1
{
public abstract class SMBAndXCommand : SMBCommand
public abstract class SMBAndXCommand : SMB1Command
{
public CommandName AndXCommand;
public byte AndXReserved;

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_SET_INFORMATION2 Request
/// </summary>
public class SetInformation2Request : SMBCommand
public class SetInformation2Request : SMB1Command
{
public const int ParametersLength = 14;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_SET_INFORMATION2 Response
/// </summary>
public class SetInformation2Response : SMBCommand
public class SetInformation2Response : SMB1Command
{
public SetInformation2Response() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_SET_INFORMATION Request
/// </summary>
public class SetInformationRequest : SMBCommand
public class SetInformationRequest : SMB1Command
{
public const int ParametersLength = 16;
public const int SupportedBufferFormat = 0x04;

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_SET_INFORMATION Response
/// </summary>
public class SetInformationResponse : SMBCommand
public class SetInformationResponse : SMB1Command
{
public SetInformationResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_TRANSACTION Request
/// </summary>
public class TransactionRequest : SMBCommand
public class TransactionRequest : SMB1Command
{
public const int FixedSMBParametersLength = 28;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_TRANSACTION Response
/// </summary>
public class TransactionResponse : SMBCommand
public class TransactionResponse : SMB1Command
{
public const int FixedSMBParametersLength = 20;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_TRANSACTION_SECONDARY Request
/// </summary>
public class TransactionSecondaryRequest : SMBCommand
public class TransactionSecondaryRequest : SMB1Command
{
public const int SMBParametersLength = 16;
// Parameters:

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_TREE_DISCONNECT Request
/// </summary>
public class TreeDisconnectRequest : SMBCommand
public class TreeDisconnectRequest : SMB1Command
{
public TreeDisconnectRequest() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_TREE_DISCONNECT Response
/// </summary>
public class TreeDisconnectResponse : SMBCommand
public class TreeDisconnectResponse : SMB1Command
{
public TreeDisconnectResponse() : base()
{

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_WRITE_RAW Final Response
/// </summary>
public class WriteRawFinalResponse : SMBCommand
public class WriteRawFinalResponse : SMB1Command
{
public ushort ParametersLength = 2;
// Parameters;

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_WRITE_RAW Interim Response
/// </summary>
public class WriteRawInterimResponse : SMBCommand
public class WriteRawInterimResponse : SMB1Command
{
public ushort ParametersLength = 2;
// Parameters;

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.SMB1
/// <summary>
/// SMB_COM_WRITE_RAW Request
/// </summary>
public class WriteRawRequest : SMBCommand
public class WriteRawRequest : SMB1Command
{
public const int ParametersFixedLength = 24; // + 4 optional bytes
// Parameters:

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// This command is obsolete.
/// Windows NT4 SP6 will send this command with empty data for some reason.
/// </summary>
public class WriteRequest : SMBCommand
public class WriteRequest : SMB1Command
{
public const int ParametersLength = 8;
public const int SupportedBufferFormat = 0x01;

View file

@ -10,7 +10,7 @@ namespace SMBLibrary.SMB1
/// This command is obsolete.
/// Windows NT4 SP6 will send this command with empty data for some reason.
/// </summary>
public class WriteResponse : SMBCommand
public class WriteResponse : SMB1Command
{
public const int ParametersLength = 2;
// Parameters:

View file

@ -19,7 +19,7 @@ namespace SMBLibrary.SMB1
public class SMBMessage
{
public SMBHeader Header;
public List<SMBCommand> Commands = new List<SMBCommand>();
public List<SMB1Command> Commands = new List<SMB1Command>();
public SMBMessage()
{
@ -29,7 +29,7 @@ namespace SMBLibrary.SMB1
public SMBMessage(byte[] buffer)
{
Header = new SMBHeader(buffer);
SMBCommand command = SMBCommand.ReadCommand(buffer, SMBHeader.Length, Header.Command, Header);
SMB1Command command = SMB1Command.ReadCommand(buffer, SMBHeader.Length, Header.Command, Header);
Commands.Add(command);
while(command is SMBAndXCommand)
{
@ -38,7 +38,7 @@ namespace SMBLibrary.SMB1
{
break;
}
command = SMBCommand.ReadCommand(buffer, andXCommand.AndXOffset, andXCommand.AndXCommand, Header);
command = SMB1Command.ReadCommand(buffer, andXCommand.AndXOffset, andXCommand.AndXCommand, Header);
Commands.Add(command);
}
}
@ -58,7 +58,7 @@ namespace SMBLibrary.SMB1
}
}
SMBCommand lastCommand = Commands[Commands.Count - 1];
SMB1Command lastCommand = Commands[Commands.Count - 1];
if (lastCommand is SMBAndXCommand)
{
((SMBAndXCommand)lastCommand).AndXCommand = CommandName.SMB_COM_NO_ANDX_COMMAND;

View file

@ -217,8 +217,8 @@
<Compile Include="SMB1\Commands\SetInformation2Response.cs" />
<Compile Include="SMB1\Commands\SetInformationRequest.cs" />
<Compile Include="SMB1\Commands\SetInformationResponse.cs" />
<Compile Include="SMB1\Commands\SMB1Command.cs" />
<Compile Include="SMB1\Commands\SMBAndXCommand.cs" />
<Compile Include="SMB1\Commands\SMBCommand.cs" />
<Compile Include="SMB1\Commands\Transaction2Request.cs" />
<Compile Include="SMB1\Commands\Transaction2Response.cs" />
<Compile Include="SMB1\Commands\Transaction2SecondaryRequest.cs" />

View file

@ -15,7 +15,7 @@ namespace SMBLibrary.Server
{
public class FileSystemResponseHelper
{
internal static SMBCommand GetCreateDirectoryResponse(SMBHeader header, CreateDirectoryRequest request, FileSystemShare share, StateObject state)
internal static SMB1Command GetCreateDirectoryResponse(SMBHeader header, CreateDirectoryRequest request, FileSystemShare share, StateObject state)
{
string userName = state.GetConnectedUserName(header.UID);
if (!share.HasWriteAccess(userName))
@ -45,7 +45,7 @@ namespace SMBLibrary.Server
return new CreateDirectoryResponse();
}
internal static SMBCommand GetDeleteDirectoryResponse(SMBHeader header, DeleteDirectoryRequest request, FileSystemShare share, StateObject state)
internal static SMB1Command GetDeleteDirectoryResponse(SMBHeader header, DeleteDirectoryRequest request, FileSystemShare share, StateObject state)
{
string userName = state.GetConnectedUserName(header.UID);
if (!share.HasWriteAccess(userName))
@ -87,7 +87,7 @@ namespace SMBLibrary.Server
}
}
internal static SMBCommand GetCheckDirectoryResponse(SMBHeader header, CheckDirectoryRequest request, FileSystemShare share)
internal static SMB1Command GetCheckDirectoryResponse(SMBHeader header, CheckDirectoryRequest request, FileSystemShare share)
{
IFileSystem fileSystem = share.FileSystem;
FileSystemEntry entry = fileSystem.GetEntry(request.DirectoryName);
@ -100,7 +100,7 @@ namespace SMBLibrary.Server
return new CheckDirectoryResponse();
}
internal static SMBCommand GetDeleteResponse(SMBHeader header, DeleteRequest request, FileSystemShare share, StateObject state)
internal static SMB1Command GetDeleteResponse(SMBHeader header, DeleteRequest request, FileSystemShare share, StateObject state)
{
string userName = state.GetConnectedUserName(header.UID);
if (!share.HasWriteAccess(userName))
@ -143,7 +143,7 @@ namespace SMBLibrary.Server
}
}
internal static SMBCommand GetRenameResponse(SMBHeader header, RenameRequest request, FileSystemShare share, StateObject state)
internal static SMB1Command GetRenameResponse(SMBHeader header, RenameRequest request, FileSystemShare share, StateObject state)
{
string userName = state.GetConnectedUserName(header.UID);
if (!share.HasWriteAccess(userName))
@ -189,7 +189,7 @@ namespace SMBLibrary.Server
}
}
internal static SMBCommand GetQueryInformationResponse(SMBHeader header, QueryInformationRequest request, FileSystemShare share)
internal static SMB1Command GetQueryInformationResponse(SMBHeader header, QueryInformationRequest request, FileSystemShare share)
{
IFileSystem fileSystem = share.FileSystem;
FileSystemEntry entry = fileSystem.GetEntry(request.FileName);
@ -207,7 +207,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetSetInformationResponse(SMBHeader header, SetInformationRequest request, FileSystemShare share, StateObject state)
internal static SMB1Command GetSetInformationResponse(SMBHeader header, SetInformationRequest request, FileSystemShare share, StateObject state)
{
string userName = state.GetConnectedUserName(header.UID);
if (!share.HasWriteAccess(userName))
@ -249,7 +249,7 @@ namespace SMBLibrary.Server
return new SetInformationResponse();
}
internal static SMBCommand GetSetInformation2Response(SMBHeader header, SetInformation2Request request, FileSystemShare share, StateObject state)
internal static SMB1Command GetSetInformation2Response(SMBHeader header, SetInformation2Request request, FileSystemShare share, StateObject state)
{
string openedFilePath = state.GetOpenedFilePath(request.FID);
if (openedFilePath == null)

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.Server
{
public class NTCreateHelper
{
internal static SMBCommand GetNTCreateResponse(SMBHeader header, NTCreateAndXRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetNTCreateResponse(SMBHeader header, NTCreateAndXRequest request, ISMBShare share, StateObject state)
{
bool isExtended = (request.Flags & NTCreateFlags.NT_CREATE_REQUEST_EXTENDED_RESPONSE) > 0;
string path = request.FileName;

View file

@ -17,7 +17,7 @@ namespace SMBLibrary.Server
/// <summary>
/// The client MUST send as many secondary requests as are needed to complete the transfer of the transaction request.
/// </summary>
internal static SMBCommand GetNTTransactResponse(SMBHeader header, NTTransactRequest request, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetNTTransactResponse(SMBHeader header, NTTransactRequest request, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
if (request.TransParameters.Length < request.TotalParameterCount ||
request.TransData.Length < request.TotalDataCount)
@ -45,7 +45,7 @@ namespace SMBLibrary.Server
/// There are no secondary response messages.
/// The client MUST send as many secondary requests as are needed to complete the transfer of the transaction request.
/// </summary>
internal static SMBCommand GetNTTransactResponse(SMBHeader header, NTTransactSecondaryRequest request, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetNTTransactResponse(SMBHeader header, NTTransactSecondaryRequest request, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
ProcessStateObject processState = state.GetProcessState(header.PID);
if (processState == null)
@ -69,7 +69,7 @@ namespace SMBLibrary.Server
}
}
internal static SMBCommand GetCompleteNTTransactResponse(SMBHeader header, NTTransactSubcommandName subcommandName, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetCompleteNTTransactResponse(SMBHeader header, NTTransactSubcommandName subcommandName, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
NTTransactSubcommand subcommand = NTTransactSubcommand.GetSubcommandRequest(subcommandName, requestSetup, requestParameters, requestData, header.UnicodeFlag);
NTTransactSubcommand subcommandResponse = null;
@ -140,7 +140,7 @@ namespace SMBLibrary.Server
}
}
private static void PrepareResponse(NTTransactResponse response, byte[] responseSetup, byte[] responseParameters, byte[] responseData, int maxBufferSize, List<SMBCommand> sendQueue)
private static void PrepareResponse(NTTransactResponse response, byte[] responseSetup, byte[] responseParameters, byte[] responseData, int maxBufferSize, List<SMB1Command> sendQueue)
{
if (NTTransactResponse.CalculateMessageSize(responseSetup.Length, responseParameters.Length, responseData.Length) <= maxBufferSize)
{

View file

@ -68,7 +68,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetSessionSetupResponse(SMBHeader header, SessionSetupAndXRequest request, INTLMAuthenticationProvider users, StateObject state)
internal static SMB1Command GetSessionSetupResponse(SMBHeader header, SessionSetupAndXRequest request, INTLMAuthenticationProvider users, StateObject state)
{
SessionSetupAndXResponse response = new SessionSetupAndXResponse();
// The PrimaryDomain field in the request is used to determine with domain controller should authenticate the user credentials,
@ -115,7 +115,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetSessionSetupResponseExtended(SMBHeader header, SessionSetupAndXRequestExtended request, INTLMAuthenticationProvider users, StateObject state)
internal static SMB1Command GetSessionSetupResponseExtended(SMBHeader header, SessionSetupAndXRequestExtended request, INTLMAuthenticationProvider users, StateObject state)
{
SessionSetupAndXResponseExtended response = new SessionSetupAndXResponseExtended();

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.Server
{
public class OpenAndXHelper
{
internal static SMBCommand GetOpenAndXResponse(SMBHeader header, OpenAndXRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetOpenAndXResponse(SMBHeader header, OpenAndXRequest request, ISMBShare share, StateObject state)
{
bool isExtended = (request.Flags & OpenFlags.SMB_OPEN_EXTENDED_RESPONSE) > 0;
string path = request.FileName;

View file

@ -17,7 +17,7 @@ namespace SMBLibrary.Server
{
public class ReadWriteResponseHelper
{
internal static SMBCommand GetReadResponse(SMBHeader header, ReadRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetReadResponse(SMBHeader header, ReadRequest request, ISMBShare share, StateObject state)
{
byte[] data = PerformRead(header, share, request.FID, request.ReadOffsetInBytes, request.CountOfBytesToRead, state);
if (header.Status != NTStatus.STATUS_SUCCESS)
@ -31,7 +31,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetReadResponse(SMBHeader header, ReadAndXRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetReadResponse(SMBHeader header, ReadAndXRequest request, ISMBShare share, StateObject state)
{
uint maxCount = request.MaxCount;
if ((share is FileSystemShare) && state.LargeRead)
@ -134,7 +134,7 @@ namespace SMBLibrary.Server
}
}
internal static SMBCommand GetWriteResponse(SMBHeader header, WriteRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetWriteResponse(SMBHeader header, WriteRequest request, ISMBShare share, StateObject state)
{
ushort bytesWritten = (ushort)PerformWrite(header, share, request.FID, request.WriteOffsetInBytes, request.Data, state);
if (header.Status != NTStatus.STATUS_SUCCESS)
@ -147,7 +147,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetWriteResponse(SMBHeader header, WriteAndXRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetWriteResponse(SMBHeader header, WriteAndXRequest request, ISMBShare share, StateObject state)
{
uint bytesWritten = PerformWrite(header, share, request.FID, request.Offset, request.Data, state);
if (header.Status != NTStatus.STATUS_SUCCESS)

View file

@ -15,7 +15,7 @@ namespace SMBLibrary.Server
{
public partial class ServerResponseHelper
{
internal static SMBCommand GetCloseResponse(SMBHeader header, CloseRequest request, ISMBShare share, StateObject state)
internal static SMB1Command GetCloseResponse(SMBHeader header, CloseRequest request, ISMBShare share, StateObject state)
{
OpenedFileObject openedFile = state.GetOpenedFileObject(request.FID);
if (openedFile == null)
@ -40,13 +40,13 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetFindClose2Request(SMBHeader header, FindClose2Request request, StateObject state)
internal static SMB1Command GetFindClose2Request(SMBHeader header, FindClose2Request request, StateObject state)
{
state.ReleaseSearchHandle(request.SearchHandle);
return new FindClose2Response();
}
internal static EchoResponse GetEchoResponse(EchoRequest request, List<SMBCommand> sendQueue)
internal static EchoResponse GetEchoResponse(EchoRequest request, List<SMB1Command> sendQueue)
{
EchoResponse response = new EchoResponse();
response.SequenceNumber = 0;

View file

@ -21,7 +21,7 @@ namespace SMBLibrary.Server
/// The client MUST send as many secondary requests as are needed to complete the transfer of the transaction request.
/// The server MUST respond to the transaction request as a whole.
/// </summary>
internal static SMBCommand GetTransactionResponse(SMBHeader header, TransactionRequest request, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetTransactionResponse(SMBHeader header, TransactionRequest request, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
ProcessStateObject processState = state.ObtainProcessState(header.PID);
processState.MaxDataCount = request.MaxDataCount;
@ -58,7 +58,7 @@ namespace SMBLibrary.Server
/// The client MUST send as many secondary requests as are needed to complete the transfer of the transaction request.
/// The server MUST respond to the transaction request as a whole.
/// </summary>
internal static SMBCommand GetTransactionResponse(SMBHeader header, TransactionSecondaryRequest request, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetTransactionResponse(SMBHeader header, TransactionSecondaryRequest request, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
ProcessStateObject processState = state.GetProcessState(header.PID);
if (processState == null)
@ -89,7 +89,7 @@ namespace SMBLibrary.Server
}
}
internal static SMBCommand GetCompleteTransactionResponse(SMBHeader header, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetCompleteTransactionResponse(SMBHeader header, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
TransactionSubcommand subcommand = TransactionSubcommand.GetSubcommandRequest(requestSetup, requestParameters, requestData, header.UnicodeFlag);
TransactionSubcommand subcommandResponse = null;
@ -162,7 +162,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetCompleteTransaction2Response(SMBHeader header, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, StateObject state, List<SMBCommand> sendQueue)
internal static SMB1Command GetCompleteTransaction2Response(SMBHeader header, byte[] requestSetup, byte[] requestParameters, byte[] requestData, ISMBShare share, StateObject state, List<SMB1Command> sendQueue)
{
Transaction2Subcommand subcommand = Transaction2Subcommand.GetSubcommandRequest(requestSetup, requestParameters, requestData, header.UnicodeFlag);
Transaction2Subcommand subcommandResponse = null;
@ -229,7 +229,7 @@ namespace SMBLibrary.Server
return response;
}
internal static void PrepareResponse(TransactionResponse response, byte[] responseSetup, byte[] responseParameters, byte[] responseData, int maxBufferSize, List<SMBCommand> sendQueue)
internal static void PrepareResponse(TransactionResponse response, byte[] responseSetup, byte[] responseParameters, byte[] responseData, int maxBufferSize, List<SMB1Command> sendQueue)
{
int responseSize = TransactionResponse.CalculateMessageSize(responseSetup.Length, responseParameters.Length, responseData.Length);
if (responseSize <= maxBufferSize)

View file

@ -14,7 +14,7 @@ namespace SMBLibrary.Server
{
public class TreeConnectHelper
{
internal static SMBCommand GetTreeConnectResponse(SMBHeader header, TreeConnectAndXRequest request, StateObject state, ShareCollection shares)
internal static SMB1Command GetTreeConnectResponse(SMBHeader header, TreeConnectAndXRequest request, StateObject state, ShareCollection shares)
{
bool isExtended = (request.Flags & TreeConnectFlags.ExtendedResponse) > 0;
string relativePath = ServerPathUtils.GetRelativeServerPath(request.Path);
@ -89,7 +89,7 @@ namespace SMBLibrary.Server
return response;
}
internal static SMBCommand GetTreeDisconnectResponse(SMBHeader header, TreeDisconnectRequest request, StateObject state)
internal static SMB1Command GetTreeDisconnectResponse(SMBHeader header, TreeDisconnectRequest request, StateObject state)
{
if (!state.IsTreeConnected(header.TID))
{

View file

@ -229,11 +229,11 @@ namespace SMBLibrary.Server
{
SMBMessage reply = new SMBMessage();
PrepareResponseHeader(reply, message);
List<SMBCommand> sendQueue = new List<SMBCommand>();
List<SMB1Command> sendQueue = new List<SMB1Command>();
foreach (SMBCommand command in message.Commands)
foreach (SMB1Command command in message.Commands)
{
SMBCommand response = ProcessCommand(reply.Header, command, state, sendQueue);
SMB1Command response = ProcessCommand(reply.Header, command, state, sendQueue);
if (response != null)
{
reply.Commands.Add(response);
@ -248,7 +248,7 @@ namespace SMBLibrary.Server
{
TrySendMessage(state, reply);
foreach (SMBCommand command in sendQueue)
foreach (SMB1Command command in sendQueue)
{
SMBMessage secondaryReply = new SMBMessage();
secondaryReply.Header = reply.Header;
@ -261,7 +261,7 @@ namespace SMBLibrary.Server
/// <summary>
/// May return null
/// </summary>
public SMBCommand ProcessCommand(SMBHeader header, SMBCommand command, StateObject state, List<SMBCommand> sendQueue)
public SMB1Command ProcessCommand(SMBHeader header, SMB1Command command, StateObject state, List<SMB1Command> sendQueue)
{
if (command is NegotiateRequest)
{