/// <summary> /// Deep copy constructor. /// </summary> public SmbNtTransactSetSecurityDescRequestPacket(SmbNtTransactSetSecurityDescRequestPacket packet) : base(packet) { this.InitDefaultValue(); this.ntTransParameters.FID = packet.ntTransParameters.FID; this.ntTransParameters.Reserved = packet.ntTransParameters.Reserved; this.ntTransParameters.SecurityInformation = packet.ntTransParameters.SecurityInformation; this.ntTransData.SecurityInformation = packet.ntTransData.SecurityInformation; }
/// <summary> /// to create a NtTransactSetSecurityDesc request packet. /// </summary> /// <param name="messageId">This field SHOULD be the multiplex ID that is used to associate a response with a /// request.</param> /// <param name="uid">This field SHOULD identify the authenticated instance of the user.</param> /// <param name="treeId">This field identifies the subdirectory (or tree) on the server that the client is /// accessing.</param> /// <param name="flags">An 8-bit field of 1-bit flags describing various features in effect for the /// message</param> /// <param name="flags2">A 16-bit field of 1-bit flags that represent various features in effect for the /// message. Unspecified bits are reserved and MUST be zero.</param> /// <param name="maxParameterCount">The maximum number of parameter bytes that the client will accept in the /// transaction reply. The server MUST NOT return more than this number of parameter bytes.</param> /// <param name="maxDataCount">The maximum number of data bytes that the client will accept in the transaction /// reply. The server MUST NOT return more than this number of data bytes.</param> /// <param name="maxSetupCount">Maximum number of setup bytes that the client will accept in the transaction /// reply. The server MUST NOT return more than this number of setup bytes</param> /// <param name="securityInfoFields">ULONG Fields of security descriptor to be set</param> /// <param name="fid">MUST contain a valid FID obtained from a previously successful SMB open command.</param> /// <param name="securityInformation">The requested security descriptor structure. The self-relative form of /// a SECURITY_DESCRIPTOR is required.</param> /// <returns>a NtTransactSetSecurityDesc request packet</returns> public SmbNtTransactSetSecurityDescRequestPacket CreateNtTransactSetSecurityDescRequest( ushort messageId, ushort uid, ushort treeId, SmbFlags flags, SmbFlags2 flags2, byte maxSetupCount, uint maxParameterCount, uint maxDataCount, ushort fid, NtTransactSecurityInformation securityInfoFields, RawSecurityDescriptor securityInformation) { SmbNtTransactSetSecurityDescRequestPacket packet = new SmbNtTransactSetSecurityDescRequestPacket(); packet.SmbHeader = CifsMessageUtils.CreateSmbHeader(SmbCommand.SMB_COM_NT_TRANSACT, messageId, uid, treeId, flags, flags2); // Set Smb_Parameters SMB_COM_NT_TRANSACT_Request_SMB_Parameters smbParameters = new SMB_COM_NT_TRANSACT_Request_SMB_Parameters(); smbParameters.MaxSetupCount = maxSetupCount; smbParameters.MaxParameterCount = maxParameterCount; smbParameters.MaxDataCount = maxDataCount; smbParameters.SetupCount = 0; // the correct count in word of the Setup is always 0. smbParameters.Function = NtTransSubCommand.NT_TRANSACT_SET_SECURITY_DESC; smbParameters.Setup = new ushort[0]; smbParameters.WordCount = (byte)(CifsMessageUtils.GetSize<SMB_COM_NT_TRANSACT_Request_SMB_Parameters>( smbParameters) / NumBytesOfWord); // Set Smb_Data SMB_COM_NT_TRANSACT_Request_SMB_Data smbData = new SMB_COM_NT_TRANSACT_Request_SMB_Data(); // Set NT_TransParameters NT_TRANSACT_SET_SECURITY_DESC_Request_NT_Trans_Parameters ntTransParameters = new NT_TRANSACT_SET_SECURITY_DESC_Request_NT_Trans_Parameters(); ntTransParameters.FID = fid; ntTransParameters.SecurityInformation = securityInfoFields; // Set NT_Data NT_TRANSACT_SET_SECURITY_DESC_Request_NT_Trans_Data ntTransData = new NT_TRANSACT_SET_SECURITY_DESC_Request_NT_Trans_Data(); ntTransData.SecurityInformation = securityInformation; packet.SmbParameters = smbParameters; packet.SmbData = smbData; packet.NtTransParameters = ntTransParameters; packet.NtTransData = ntTransData; packet.UpdateCountAndOffset(); return packet; }
public SmbNtTransactSetSecurityDescResponsePacket CreateNtTransactSetSecurityDescResponse( CifsServerPerConnection connection, SmbNtTransactSetSecurityDescRequestPacket request) { SmbNtTransactSetSecurityDescResponsePacket response = new SmbNtTransactSetSecurityDescResponsePacket(); response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request); response.UpdateCountAndOffset(); return response; }