mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 02:37:49 +02:00
SMB1: SMB_COM_TRANSACTION / SMB_COM_TRANSACTION2: interim response will now be sent when required
This commit is contained in:
parent
4d51c7eed4
commit
b3df4dd01c
5 changed files with 102 additions and 4 deletions
|
@ -196,7 +196,16 @@ namespace SMBLibrary.SMB1
|
|||
case CommandName.SMB_COM_LOCKING_ANDX:
|
||||
return new LockingAndXResponse(buffer, offset);
|
||||
case CommandName.SMB_COM_TRANSACTION:
|
||||
{
|
||||
if (wordCount * 2 == TransactionInterimResponse.ParametersLength)
|
||||
{
|
||||
return new TransactionInterimResponse(buffer, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TransactionResponse(buffer, offset);
|
||||
}
|
||||
}
|
||||
case CommandName.SMB_COM_ECHO:
|
||||
return new EchoResponse(buffer, offset);
|
||||
case CommandName.SMB_COM_OPEN_ANDX:
|
||||
|
@ -219,7 +228,16 @@ namespace SMBLibrary.SMB1
|
|||
case CommandName.SMB_COM_WRITE_ANDX:
|
||||
return new WriteAndXResponse(buffer, offset);
|
||||
case CommandName.SMB_COM_TRANSACTION2:
|
||||
{
|
||||
if (wordCount * 2 == Transaction2InterimResponse.ParametersLength)
|
||||
{
|
||||
return new Transaction2InterimResponse(buffer, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Transaction2Response(buffer, offset);
|
||||
}
|
||||
}
|
||||
case CommandName.SMB_COM_FIND_CLOSE2:
|
||||
return new FindClose2Response(buffer, offset);
|
||||
case CommandName.SMB_COM_TREE_DISCONNECT:
|
||||
|
|
31
SMBLibrary/SMB1/Commands/Transaction2InterimResponse.cs
Normal file
31
SMBLibrary/SMB1/Commands/Transaction2InterimResponse.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
*
|
||||
* You can redistribute this program and/or modify it under the terms of
|
||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Utilities;
|
||||
|
||||
namespace SMBLibrary.SMB1
|
||||
{
|
||||
public class Transaction2InterimResponse : TransactionInterimResponse
|
||||
{
|
||||
public Transaction2InterimResponse() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public Transaction2InterimResponse(byte[] buffer, int offset) : base(buffer, offset)
|
||||
{
|
||||
}
|
||||
|
||||
public override CommandName CommandName
|
||||
{
|
||||
get
|
||||
{
|
||||
return CommandName.SMB_COM_TRANSACTION2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
41
SMBLibrary/SMB1/Commands/TransactionInterimResponse.cs
Normal file
41
SMBLibrary/SMB1/Commands/TransactionInterimResponse.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
*
|
||||
* You can redistribute this program and/or modify it under the terms of
|
||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Utilities;
|
||||
|
||||
namespace SMBLibrary.SMB1
|
||||
{
|
||||
/// <summary>
|
||||
/// SMB_COM_TRANSACTION Interim Response
|
||||
/// </summary>
|
||||
public class TransactionInterimResponse : SMB1Command
|
||||
{
|
||||
public const int ParametersLength = 0;
|
||||
|
||||
public TransactionInterimResponse() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public TransactionInterimResponse(byte[] buffer, int offset) : base(buffer, offset, false)
|
||||
{
|
||||
}
|
||||
|
||||
public override byte[] GetBytes(bool isUnicode)
|
||||
{
|
||||
return base.GetBytes(isUnicode);
|
||||
}
|
||||
|
||||
public override CommandName CommandName
|
||||
{
|
||||
get
|
||||
{
|
||||
return CommandName.SMB_COM_TRANSACTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -310,9 +310,11 @@
|
|||
<Compile Include="SMB1\Commands\SetInformationResponse.cs" />
|
||||
<Compile Include="SMB1\Commands\SMB1Command.cs" />
|
||||
<Compile Include="SMB1\Commands\SMBAndXCommand.cs" />
|
||||
<Compile Include="SMB1\Commands\Transaction2InterimResponse.cs" />
|
||||
<Compile Include="SMB1\Commands\Transaction2Request.cs" />
|
||||
<Compile Include="SMB1\Commands\Transaction2Response.cs" />
|
||||
<Compile Include="SMB1\Commands\Transaction2SecondaryRequest.cs" />
|
||||
<Compile Include="SMB1\Commands\TransactionInterimResponse.cs" />
|
||||
<Compile Include="SMB1\Commands\TransactionRequest.cs" />
|
||||
<Compile Include="SMB1\Commands\TransactionResponse.cs" />
|
||||
<Compile Include="SMB1\Commands\TransactionSecondaryRequest.cs" />
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace SMBLibrary.Server.SMB1
|
|||
public class TransactionHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// There are no interim response messages.
|
||||
/// 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>
|
||||
|
@ -38,7 +37,14 @@ namespace SMBLibrary.Server.SMB1
|
|||
ByteWriter.WriteBytes(processState.TransactionData, 0, request.TransData);
|
||||
processState.TransactionParametersReceived += request.TransParameters.Length;
|
||||
processState.TransactionDataReceived += request.TransData.Length;
|
||||
return new List<SMB1Command>();
|
||||
if (request is Transaction2Request)
|
||||
{
|
||||
return new Transaction2InterimResponse();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TransactionInterimResponse();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue