mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 02:37:49 +02:00
SMB1: Improved handling of UnsupportedInformationLevelException
This commit is contained in:
parent
198443b304
commit
112ab74cc3
2 changed files with 12 additions and 19 deletions
|
@ -53,7 +53,16 @@ namespace SMBLibrary.Server.SMB1
|
||||||
int entriesToReturn = Math.Min(subcommand.SearchCount, entries.Count);
|
int entriesToReturn = Math.Min(subcommand.SearchCount, entries.Count);
|
||||||
List<QueryDirectoryFileInformation> segment = entries.GetRange(0, entriesToReturn);
|
List<QueryDirectoryFileInformation> segment = entries.GetRange(0, entriesToReturn);
|
||||||
int maxLength = (int)state.GetMaxDataCount(header.PID).Value;
|
int maxLength = (int)state.GetMaxDataCount(header.PID).Value;
|
||||||
FindInformationList findInformationList = SMB1FileStoreHelper.GetFindInformationList(segment, subcommand.InformationLevel, header.UnicodeFlag, returnResumeKeys, maxLength);
|
FindInformationList findInformationList;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
findInformationList = SMB1FileStoreHelper.GetFindInformationList(segment, subcommand.InformationLevel, header.UnicodeFlag, returnResumeKeys, maxLength);
|
||||||
|
}
|
||||||
|
catch (UnsupportedInformationLevelException)
|
||||||
|
{
|
||||||
|
header.Status = NTStatus.STATUS_OS2_INVALID_LEVEL;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
int returnCount = findInformationList.Count;
|
int returnCount = findInformationList.Count;
|
||||||
Transaction2FindFirst2Response response = new Transaction2FindFirst2Response();
|
Transaction2FindFirst2Response response = new Transaction2FindFirst2Response();
|
||||||
response.SetFindInformationList(findInformationList, header.UnicodeFlag);
|
response.SetFindInformationList(findInformationList, header.UnicodeFlag);
|
||||||
|
|
|
@ -257,28 +257,12 @@ namespace SMBLibrary.Server
|
||||||
else if (command is TransactionRequest) // Both TransactionRequest and Transaction2Request
|
else if (command is TransactionRequest) // Both TransactionRequest and Transaction2Request
|
||||||
{
|
{
|
||||||
TransactionRequest request = (TransactionRequest)command;
|
TransactionRequest request = (TransactionRequest)command;
|
||||||
try
|
return TransactionHelper.GetTransactionResponse(header, request, share, state);
|
||||||
{
|
|
||||||
return TransactionHelper.GetTransactionResponse(header, request, share, state);
|
|
||||||
}
|
|
||||||
catch (UnsupportedInformationLevelException)
|
|
||||||
{
|
|
||||||
header.Status = NTStatus.STATUS_INVALID_PARAMETER;
|
|
||||||
return new ErrorResponse(command.CommandName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (command is TransactionSecondaryRequest) // Both TransactionSecondaryRequest and Transaction2SecondaryRequest
|
else if (command is TransactionSecondaryRequest) // Both TransactionSecondaryRequest and Transaction2SecondaryRequest
|
||||||
{
|
{
|
||||||
TransactionSecondaryRequest request = (TransactionSecondaryRequest)command;
|
TransactionSecondaryRequest request = (TransactionSecondaryRequest)command;
|
||||||
try
|
return TransactionHelper.GetTransactionResponse(header, request, share, state);
|
||||||
{
|
|
||||||
return TransactionHelper.GetTransactionResponse(header, request, share, state);
|
|
||||||
}
|
|
||||||
catch (UnsupportedInformationLevelException)
|
|
||||||
{
|
|
||||||
header.Status = NTStatus.STATUS_INVALID_PARAMETER;
|
|
||||||
return new ErrorResponse(command.CommandName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (command is NTTransactRequest)
|
else if (command is NTTransactRequest)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue