internal static MessageStatus WorkAroundSetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset, MessageStatus returnedStatus, ITestSite site) { if (inputBufferSize != InputBufferSize.LessThan && currentByteOffset == InputBufferCurrentByteOffset.NotValid) { // For SMB server, when InputBufferCurrentByteOffset is not valid, it does not failed with STATUS_INVALID_PARAMETER. // Instead, it return with STATUS_SUCCESS, and setting "EaErrorOffset" warning in the response buffer to tell user the offset is not correct. // To keep same model behavior according to MS-FSA, transfer the error code to STATUS_INVALID_PARAMETER returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3004, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } return(returnedStatus); }
internal static MessageStatus WorkAroundSetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset, MessageStatus returnedStatus, ITestSite site) { if (inputBufferSize != InputBufferSize.LessThan && currentByteOffset == InputBufferCurrentByteOffset.NotValid) { // [MS-SMB2] Section 3.3.5.20.1 Handling SMB2_0_INFO_FILE // If the request is for the FilePositionInformation information class, the SMB2 server SHOULD (348) set the CurrentByteOffset field to zero. // (348) Section 3.3.5.20.1: Windows-based SMB2 servers will set CurrentByteOffset to any value. // Per tested with Win2012/Win2012R2 SMB2 server, they return STATUS_SUCCESS. // To keep same model behavior according to MS-FSA, transfer the error code to STATUS_INVALID_PARAMETER returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3004, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } return(returnedStatus); }
public static MessageStatus SetFileSysInfo( FileSystemInfoClass fileInfoClass, InputBufferSize inputBufferSize ) { //serverSet = validateServerSet; switch (fileInfoClass) { case (FileSystemInfoClass.File_FsVolumeInformation): { Helper.CaptureRequirement(3219, @"[In FileFsVolumeInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } case (FileSystemInfoClass.File_FsLabelInformation): { Helper.CaptureRequirement(3221, @"[In FileFsLabelInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } case (FileSystemInfoClass.File_FsSizeInformation): { Helper.CaptureRequirement(3223, @"[In FileFsSizeInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } case (FileSystemInfoClass.File_FsDevice_Information): { Helper.CaptureRequirement(3225, @"[In FileFsDeviceInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } case (FileSystemInfoClass.File_FsAttribute_Information): { Helper.CaptureRequirement(3227, @"[In FileFsAttributeInformation] This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } case (FileSystemInfoClass.File_FsControlInformation): { //If InputBufferSize is smaller than BlockAlign( sizeof( FILE_FS_CONTROL_INFORMATION ), 8 ) the operation MUST be failed with STATUS_INVALID_INFO_CLASS. if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(4568, @"[In FileFsControlInformation]Pseudocode for the operation is as follows: If InputBufferSize is smaller than BlockAlign( sizeof( FILE_FS_CONTROL_INFORMATION ), 8 ) the operation MUST be failed with STATUS_INVALID_INFO_CLASS."); return MessageStatus.INVALID_INFO_CLASS; } if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4570, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } if (!IsQuotasSupported) { Helper.CaptureRequirement(4571, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] If Open.File.Volume.IsQuotasSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } Helper.CaptureRequirement(4576, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } case (FileSystemInfoClass.File_FsFullSize_Information): { Helper.CaptureRequirement(3229, @"[In FileFsFullSizeInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } case (FileSystemInfoClass.File_FsObjectId_Information): { //If InputBufferSize is less than sizeof( FILE_FS_OBJECTID_INFORMATION ), the operation MUST be failed with STATUS_INVALID_INFO_CLASS. if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(4578, @"[In FileFsObjectIdInformation]Pseudocode for the operation is as follows: If InputBufferSize is less than sizeof( FILE_FS_OBJECTID_INFORMATION ), the operation MUST be failed with STATUS_INVALID_INFO_CLASS."); return MessageStatus.INVALID_INFO_CLASS; } if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4579, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] Support for ObjectIDs is OPTIONAL. If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } if (!isObjectIDsSupportedTrue) { Helper.CaptureRequirement(4580, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } Helper.CaptureRequirement(4583, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } case FileSystemInfoClass.File_FsDriverPath_Information: { Helper.CaptureRequirement(3231, @"[In FileFsDriverPathInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return MessageStatus.NOT_SUPPORTED; } } Helper.CaptureRequirement(3216, @"[In Server Requests Setting of File System Information]The object store MUST return:[Status]."); return MessageStatus.SUCCESS; }
public static MessageStatus SetFileSysInfo( FileSystemInfoClass fileInfoClass, InputBufferSize inputBufferSize ) { //serverSet = validateServerSet; switch (fileInfoClass) { case (FileSystemInfoClass.File_FsVolumeInformation): { Helper.CaptureRequirement(3219, @"[In FileFsVolumeInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } case (FileSystemInfoClass.File_FsLabelInformation): { Helper.CaptureRequirement(3221, @"[In FileFsLabelInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } case (FileSystemInfoClass.File_FsSizeInformation): { Helper.CaptureRequirement(3223, @"[In FileFsSizeInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } case (FileSystemInfoClass.File_FsDevice_Information): { Helper.CaptureRequirement(3225, @"[In FileFsDeviceInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } case (FileSystemInfoClass.File_FsAttribute_Information): { Helper.CaptureRequirement(3227, @"[In FileFsAttributeInformation] This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } case (FileSystemInfoClass.File_FsControlInformation): { //If InputBufferSize is smaller than BlockAlign( sizeof( FILE_FS_CONTROL_INFORMATION ), 8 ) the operation MUST be failed with STATUS_INVALID_INFO_CLASS. if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(4568, @"[In FileFsControlInformation]Pseudocode for the operation is as follows: If InputBufferSize is smaller than BlockAlign( sizeof( FILE_FS_CONTROL_INFORMATION ), 8 ) the operation MUST be failed with STATUS_INVALID_INFO_CLASS."); return(MessageStatus.INVALID_INFO_CLASS); } if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4570, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER."); return(MessageStatus.INVALID_PARAMETER); } if (!IsQuotasSupported) { Helper.CaptureRequirement(4571, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] If Open.File.Volume.IsQuotasSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return(MessageStatus.STATUS_VOLUME_NOT_UPGRADED); } Helper.CaptureRequirement(4576, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return(MessageStatus.SUCCESS); } case (FileSystemInfoClass.File_FsFullSize_Information): { Helper.CaptureRequirement(3229, @"[In FileFsFullSizeInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } case (FileSystemInfoClass.File_FsObjectId_Information): { //If InputBufferSize is less than sizeof( FILE_FS_OBJECTID_INFORMATION ), the operation MUST be failed with STATUS_INVALID_INFO_CLASS. if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(4578, @"[In FileFsObjectIdInformation]Pseudocode for the operation is as follows: If InputBufferSize is less than sizeof( FILE_FS_OBJECTID_INFORMATION ), the operation MUST be failed with STATUS_INVALID_INFO_CLASS."); return(MessageStatus.INVALID_INFO_CLASS); } if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4579, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] Support for ObjectIDs is OPTIONAL. If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER."); return(MessageStatus.INVALID_PARAMETER); } if (!isObjectIDsSupportedTrue) { Helper.CaptureRequirement(4580, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return(MessageStatus.STATUS_VOLUME_NOT_UPGRADED); } Helper.CaptureRequirement(4583, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return(MessageStatus.SUCCESS); } case FileSystemInfoClass.File_FsDriverPath_Information: { Helper.CaptureRequirement(3231, @"[In FileFsDriverPathInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED."); return(MessageStatus.NOT_SUPPORTED); } } Helper.CaptureRequirement(3216, @"[In Server Requests Setting of File System Information]The object store MUST return:[Status]."); return(MessageStatus.SUCCESS); }
internal static MessageStatus WorkAroundSetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset, MessageStatus returnedStatus, ITestSite site) { if (inputBufferSize != InputBufferSize.LessThan && currentByteOffset == InputBufferCurrentByteOffset.NotValid) { // [MS-SMB2] Section 3.3.5.20.1 Handling SMB2_0_INFO_FILE // If the request is for the FilePositionInformation information class, the SMB2 server SHOULD (348) set the CurrentByteOffset field to zero. // (348) Section 3.3.5.20.1: Windows-based SMB2 servers will set CurrentByteOffset to any value. // Per tested with Win2012/Win2012R2 SMB2 server, they return STATUS_SUCCESS. // To keep same model behavior according to MS-FSA, transfer the error code to STATUS_INVALID_PARAMETER returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3004, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } return returnedStatus; }
public static MessageStatus SetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset) { // If InputBufferSize is less than the size, in bytes, of the FILE_POSITION_INFORMATION structure if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(3002, @"[In FilePositionInformation]Pseudocode for the operation is as follows: If InputBufferSize is less than the size, in bytes, of the FILE_POSITION_INFORMATION structure, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } //InputBuffer.CurrentByteOffset is less than 0. if (currentByteOffset == InputBufferCurrentByteOffset.LessThanZero) { Helper.CaptureRequirement(3003, @"[In FilePositionInformation,Pseudocode for the operation is as follows:]The operation MUST be failed with STATUS_INVALID_PARAMETER under either of the following conditions:InputBuffer.CurrentByteOffset is less than 0."); return MessageStatus.INVALID_PARAMETER; } //Open.Mode contains FILE_NO_INTERMEDIATE_BUFFERING and InputBuffer.CurrentByteOffset is not an integer multiple of Open.File.Volume.SectorSize. if (((gOpenMode & CreateOptions.NO_INTERMEDIATE_BUFFERING) != 0) && (currentByteOffset == InputBufferCurrentByteOffset.NotValid)) { Helper.CaptureRequirement(3004, @"[In FilePositionInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under either of the following conditions: Open.Mode contains FILE_NO_INTERMEDIATE_BUFFERING and InputBuffer.CurrentByteOffset is not an integer multiple of Open.File.Volume.SectorSize."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(3006, @"[In FilePositionInformation,Pseudocode for the operation is as follows:]The operation returns STATUS_SUCCESS.<63>"); return MessageStatus.SUCCESS; }
public static MessageStatus SetFileBasicInfo(InputBufferSize inputBufferSize, InputBufferTime inputBufferTime) { // If InputBufferSize is less than the size of the FILE_BASIC_INFORMATION structure if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(2871, @"[In FileBasicInformation]Pseudocode for the operation is as follows: If InputBufferSize is less than sizeof( FILE_BASIC_INFORMATION ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } if ((inputBufferTime == InputBufferTime.CreationTimeLessthanM1) || (inputBufferTime == InputBufferTime.LastAccessTimeLessthanM1) || (inputBufferTime == InputBufferTime.LastWriteTimeLessthanM1) || (inputBufferTime == InputBufferTime.ChangeTimeLessthanM1)) { Helper.CaptureRequirement(2872, @"[In FileBasicInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions: If InputBuffer.CreationTime is less than -1."); Helper.CaptureRequirement(2873, @"[In FileBasicInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions: If InputBuffer.LastAccessTime is less than -1."); Helper.CaptureRequirement(2874, @"[In FileBasicInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions: If InputBuffer.LastWriteTime is less than -1."); Helper.CaptureRequirement(2875, @"[In FileBasicInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions: If InputBuffer.ChangeTime is less than -1."); return MessageStatus.INVALID_PARAMETER; } //If InputBuffer.FileAttributes.FILE_ATTRIBUTE_DIRECTORY is true and Open.Stream.StreamType is DataStream if (((gFileAttribute & FileAttribute.DIRECTORY) != 0) && (gStreamType == StreamType.DataStream)) { Helper.CaptureRequirement(2876, @"[In FileBasicInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions: If InputBuffer.FileAttributes.FILE_ATTRIBUTE_DIRECTORY is TRUE and Open.Stream.StreamType is DataStream."); return MessageStatus.INVALID_PARAMETER; } //If InputBuffer.FileAttributes.FILE_ATTRIBUTE_TEMPORARY is true and Open.File.FileType is DirectoryFile. if (((gFileAttribute & FileAttribute.TEMPORARY) != 0) && (gStreamType == StreamType.DirectoryStream)) { Helper.CaptureRequirement(2877, @"[In FileBasicInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions: If InputBuffer.FileAttributes.FILE_ATTRIBUTE_TEMPORARY is TRUE and Open.File.FileType is DirectoryFile."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(2910, @"[In FileBasicInformation,Pseudocode for the operation is as follows:]The operation returns STATUS_SUCCESS."); return MessageStatus.SUCCESS; }