示例#1
0
        public void ContentServer_SmbServer_HashV2FileBased()
        {
            CheckApplicability();

            contentInformationUtility.RetrieveContentData();

            using (Smb2ClientSupportDialect smb2Client = new Smb2ClientSupportDialect(testConfig.Timeout, DialectRevision.Smb30))
            {
                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_2,
                               SRV_READ_HASH_Request_HashRetrievalType_Values.SRV_HASH_RETRIEVE_FILE_BASED,
                               0,
                               uint.MaxValue,
                               out hashHeader,
                               out hashData)) != Smb2Status.STATUS_HASH_NOT_PRESENT,
                    testConfig.Timeout,
                    testConfig.RetryInterval);

                if (testConfig.HashLevelType == ServerHashLevel.HashDisableAll)
                {
                    BaseTestSite.Assert.AreEqual(
                        Smb2Status.STATUS_HASH_NOT_SUPPORTED,
                        smb2Status,
                        "Server MUST fail the SRV_READ_HASH request with STATUS_HASH_NOT_SUPPORTED if ServerHashLevel is HashDisableAll, but the actual status is {0}.", Smb2Status.GetStatusCode(smb2Status));
                }
                else if (testConfig.HashLevelType == ServerHashLevel.HashEnableShare && !smb2Client.isShareHashEnabled)
                {
                    BaseTestSite.Assert.AreEqual(
                        Smb2Status.STATUS_HASH_NOT_SUPPORTED,
                        smb2Status,
                        "Server MUST fail the SRV_READ_HASH request with STATUS_HASH_NOT_SUPPORTED if ServerHashLevel is HashEnableShare and Open.TreeConnect.Share.Enabled is FALSE, but the actual status is {0}.", Smb2Status.GetStatusCode(smb2Status));
                }
                else
                {
                    BaseTestSite.Assert.AreEqual(
                        Smb2Status.STATUS_SUCCESS,
                        smb2Status,
                        "Dialect 3.0 should support SRV_HASH_RETRIEVE_HASH_BASED, but the actual status is {0}.", Smb2Status.GetStatusCode(smb2Status));
                }

                smb2Client.CloseFile();
            }
        }
示例#2
0
        public void ContentServer_SmbServer_HashV2HashBased_Smb21()
        {
            CheckApplicability();

            contentInformationUtility.RetrieveContentData();

            using (Smb2ClientSupportDialect smb2Client = new Smb2ClientSupportDialect(testConfig.Timeout, DialectRevision.Smb21))
            {
                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_2,
                               SRV_READ_HASH_Request_HashRetrievalType_Values.SRV_HASH_RETRIEVE_HASH_BASED,
                               0,
                               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 hash type");

                BaseTestSite.CaptureRequirementIfAreEqual(
                    Smb2Status.STATUS_INVALID_PARAMETER,
                    smb2Status,
                    RequirementCategory.InvalidParameter,
                    RequirementCategory.InvalidParameterMessage);

                smb2Client.CloseFile();
            }
        }
        public void ContentServer_SmbServer_HashV2HashBased_Smb21()
        {
            CheckApplicability();

            contentInformationUtility.RetrieveContentData();

            using (Smb2ClientSupportDialect smb2Client = new Smb2ClientSupportDialect(testConfig.Timeout, DialectRevision.Smb21))
            {
                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_2,
                        SRV_READ_HASH_Request_HashRetrievalType_Values.SRV_HASH_RETRIEVE_HASH_BASED,
                        0,
                        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 hash type");

                BaseTestSite.CaptureRequirementIfAreEqual(
                    Smb2Status.STATUS_INVALID_PARAMETER,
                    smb2Status,
                    RequirementCategory.InvalidParameter,
                    RequirementCategory.InvalidParameterMessage);

                smb2Client.CloseFile();
            }
        }
        public void ContentServer_SmbServer_HashV2FileBased()
        {
            CheckApplicability();

            contentInformationUtility.RetrieveContentData();

            using (Smb2ClientSupportDialect smb2Client = new Smb2ClientSupportDialect(testConfig.Timeout, DialectRevision.Smb30))
            {
                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_2,
                        SRV_READ_HASH_Request_HashRetrievalType_Values.SRV_HASH_RETRIEVE_FILE_BASED,
                        0,
                        uint.MaxValue,
                        out hashHeader,
                        out hashData)) != Smb2Status.STATUS_HASH_NOT_PRESENT,
                        testConfig.Timeout,
                        testConfig.RetryInterval);

                if (testConfig.HashLevelType == ServerHashLevel.HashDisableAll)
                {
                    BaseTestSite.Assert.AreEqual(
                        Smb2Status.STATUS_HASH_NOT_SUPPORTED,
                        smb2Status,
                        "Server MUST fail the SRV_READ_HASH request with STATUS_HASH_NOT_SUPPORTED if ServerHashLevel is HashDisableAll, but the actual status is {0}.", Smb2Status.GetStatusCode(smb2Status));
                }
                else if (testConfig.HashLevelType == ServerHashLevel.HashEnableShare && !smb2Client.isShareHashEnabled)
                {
                    BaseTestSite.Assert.AreEqual(
                        Smb2Status.STATUS_HASH_NOT_SUPPORTED,
                        smb2Status,
                        "Server MUST fail the SRV_READ_HASH request with STATUS_HASH_NOT_SUPPORTED if ServerHashLevel is HashEnableShare and Open.TreeConnect.Share.Enabled is FALSE, but the actual status is {0}.", Smb2Status.GetStatusCode(smb2Status));
                }
                else
                {
                    BaseTestSite.Assert.AreEqual(
                    Smb2Status.STATUS_SUCCESS,
                    smb2Status,
                    "Dialect 3.0 should support SRV_HASH_RETRIEVE_HASH_BASED, but the actual status is {0}.", Smb2Status.GetStatusCode(smb2Status));
                }

                smb2Client.CloseFile();
            }
        }