public void ContentServer_SmbServer_HashRetrivalTypeInvalid() { CheckApplicability(); contentInformationUtility.RetrieveContentData(); using (Smb2ClientTransport smb2Client = new Smb2ClientTransport(testConfig.Timeout)) { smb2Client.OpenFile( testConfig.ContentServerComputerName, testConfig.SharedFolderName, testConfig.NameOfFileWithMultipleBlocks, testConfig.SecurityPackageType, testConfig.DomainName, testConfig.UserName, testConfig.UserPassword, AccessMask.GENERIC_READ); HASH_HEADER hashHeader; byte[] hashData; uint smb2Status = smb2Client.ReadHash( SRV_READ_HASH_Request_HashType_Values.SRV_HASH_TYPE_PEER_DIST, SRV_READ_HASH_Request_HashVersion_Values.SRV_HASH_VER_1, (SRV_READ_HASH_Request_HashRetrievalType_Values)0xFEFEFEFE, 0, uint.MaxValue, out hashHeader, out hashData); BaseTestSite.Assert.AreNotEqual( Smb2Status.STATUS_SUCCESS, smb2Status, "The content server should return error for invalid hash retrieval type"); BaseTestSite.CaptureRequirementIfAreEqual( Smb2Status.STATUS_INVALID_PARAMETER, smb2Status, RequirementCategory.InvalidParameter, RequirementCategory.InvalidParameterMessage); smb2Client.CloseFile(); } }
public void ContentServer_SmbServer_OffsetInvalid() { CheckApplicability(); contentInformationUtility.RetrieveContentData(); using (Smb2ClientTransport smb2Client = new Smb2ClientTransport(testConfig.Timeout)) { smb2Client.OpenFile( testConfig.ContentServerComputerName, testConfig.SharedFolderName, testConfig.NameOfFileWithMultipleBlocks, testConfig.SecurityPackageType, testConfig.DomainName, testConfig.UserName, testConfig.UserPassword, AccessMask.GENERIC_READ); HASH_HEADER hashHeader; byte[] hashData; uint smb2Status = 0; TestUtility.DoUntilSucceed( () => (smb2Status = smb2Client.ReadHash( SRV_READ_HASH_Request_HashType_Values.SRV_HASH_TYPE_PEER_DIST, SRV_READ_HASH_Request_HashVersion_Values.SRV_HASH_VER_1, SRV_READ_HASH_Request_HashRetrievalType_Values.SRV_HASH_RETRIEVE_HASH_BASED, uint.MaxValue, uint.MaxValue, out hashHeader, out hashData)) != Smb2Status.STATUS_HASH_NOT_PRESENT, testConfig.Timeout, testConfig.RetryInterval); BaseTestSite.Assert.AreNotEqual( Smb2Status.STATUS_SUCCESS, smb2Status, "The content server should return error for invalid offset"); /// If the HashRetrievalType is SRV_HASH_RETRIEVE_FILE_BASED and Offset field of the SRV_READ_HASH request is equal to or beyond the end of the file /// represented by Open.LocalOpen, the server MUST fail the SRV_READ_HASH request with error code STATUS_END_OF_FILE. BaseTestSite.CaptureRequirementIfAreEqual( Smb2Status.STATUS_END_OF_FILE, smb2Status, RequirementCategory.EndOfFile, RequirementCategory.EndOfFileMessage); smb2Client.CloseFile(); } }