SMB1: Renamed NT_TRANSACT_SET_SECURITY_DESC request and added response implementation

This commit is contained in:
Tal Aloni 2017-09-25 23:27:41 +03:00
parent bf0295b697
commit de355f93d8
5 changed files with 38 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved. /* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
* *
* You can redistribute this program and/or modify it under the terms of * 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, * the GNU Lesser Public License as published by the Free Software Foundation,
@ -6,7 +6,6 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using Utilities; using Utilities;
namespace SMBLibrary.SMB1 namespace SMBLibrary.SMB1
@ -14,7 +13,7 @@ namespace SMBLibrary.SMB1
/// <summary> /// <summary>
/// NT_TRANSACT_SET_SECURITY_DESC Request /// NT_TRANSACT_SET_SECURITY_DESC Request
/// </summary> /// </summary>
public class NTTransactSetSecurityDescriptor : NTTransactSubcommand public class NTTransactSetSecurityDescriptorRequest : NTTransactSubcommand
{ {
public const int ParametersLength = 8; public const int ParametersLength = 8;
// Parameters: // Parameters:
@ -24,11 +23,11 @@ namespace SMBLibrary.SMB1
// Data: // Data:
public SecurityDescriptor SecurityDescriptor; public SecurityDescriptor SecurityDescriptor;
public NTTransactSetSecurityDescriptor() public NTTransactSetSecurityDescriptorRequest()
{ {
} }
public NTTransactSetSecurityDescriptor(byte[] parameters, byte[] data) public NTTransactSetSecurityDescriptorRequest(byte[] parameters, byte[] data)
{ {
FID = LittleEndianConverter.ToUInt16(parameters, 0); FID = LittleEndianConverter.ToUInt16(parameters, 0);
Reserved = LittleEndianConverter.ToUInt16(parameters, 2); Reserved = LittleEndianConverter.ToUInt16(parameters, 2);

View file

@ -0,0 +1,30 @@
/* Copyright (C) 2014-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>
/// NT_TRANSACT_SET_SECURITY_DESC Response
/// </summary>
public class NTTransactSetSecurityDescriptorResponse : NTTransactSubcommand
{
public NTTransactSetSecurityDescriptorResponse()
{
}
public override NTTransactSubcommandName SubcommandName
{
get
{
return NTTransactSubcommandName.NT_TRANSACT_SET_SECURITY_DESC;
}
}
}
}

View file

@ -46,7 +46,7 @@ namespace SMBLibrary.SMB1
case NTTransactSubcommandName.NT_TRANSACT_IOCTL: case NTTransactSubcommandName.NT_TRANSACT_IOCTL:
return new NTTransactIOCTLRequest(setup, data); return new NTTransactIOCTLRequest(setup, data);
case NTTransactSubcommandName.NT_TRANSACT_SET_SECURITY_DESC: case NTTransactSubcommandName.NT_TRANSACT_SET_SECURITY_DESC:
return new NTTransactSetSecurityDescriptor(parameters, data); return new NTTransactSetSecurityDescriptorRequest(parameters, data);
case NTTransactSubcommandName.NT_TRANSACT_NOTIFY_CHANGE: case NTTransactSubcommandName.NT_TRANSACT_NOTIFY_CHANGE:
return new NTTransactNotifyChangeRequest(setup); return new NTTransactNotifyChangeRequest(setup);
case NTTransactSubcommandName.NT_TRANSACT_QUERY_SECURITY_DESC: case NTTransactSubcommandName.NT_TRANSACT_QUERY_SECURITY_DESC:

View file

@ -414,7 +414,8 @@
<Compile Include="SMB1\NTTransactSubcommands\NTTransactNotifyChangeResponse.cs" /> <Compile Include="SMB1\NTTransactSubcommands\NTTransactNotifyChangeResponse.cs" />
<Compile Include="SMB1\NTTransactSubcommands\NTTransactQuerySecurityDescriptorRequest.cs" /> <Compile Include="SMB1\NTTransactSubcommands\NTTransactQuerySecurityDescriptorRequest.cs" />
<Compile Include="SMB1\NTTransactSubcommands\NTTransactQuerySecurityDescriptorResponse.cs" /> <Compile Include="SMB1\NTTransactSubcommands\NTTransactQuerySecurityDescriptorResponse.cs" />
<Compile Include="SMB1\NTTransactSubcommands\NTTransactSetSecurityDescriptor.cs" /> <Compile Include="SMB1\NTTransactSubcommands\NTTransactSetSecurityDescriptorRequest.cs" />
<Compile Include="SMB1\NTTransactSubcommands\NTTransactSetSecurityDescriptorResponse.cs" />
<Compile Include="SMB1\NTTransactSubcommands\NTTransactSubcommand.cs" /> <Compile Include="SMB1\NTTransactSubcommands\NTTransactSubcommand.cs" />
<Compile Include="SMB1\ServiceNameHelper.cs" /> <Compile Include="SMB1\ServiceNameHelper.cs" />
<Compile Include="SMB1\SMB1Header.cs" /> <Compile Include="SMB1\SMB1Header.cs" />

View file

@ -96,7 +96,7 @@ namespace SMBLibrary.Server.SMB1
{ {
subcommandResponse = GetSubcommandResponse(header, maxDataCount, (NTTransactIOCTLRequest)subcommand, share, state); subcommandResponse = GetSubcommandResponse(header, maxDataCount, (NTTransactIOCTLRequest)subcommand, share, state);
} }
else if (subcommand is NTTransactSetSecurityDescriptor) else if (subcommand is NTTransactSetSecurityDescriptorRequest)
{ {
header.Status = NTStatus.STATUS_NOT_IMPLEMENTED; header.Status = NTStatus.STATUS_NOT_IMPLEMENTED;
} }