public void ReadConfig(out ModelDialectRevision dialectRevision)
        {
            // No need to run the case if SMB2_CREATE_APP_INSTANCE_ID is not supported.
            testConfig.CheckCreateContext(CreateContextTypeValue.SMB2_CREATE_APP_INSTANCE_ID);

            dialectRevision = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported);
        }
        public void ReadConfig(out OplockConfig c)
        {
            c = new OplockConfig
            {
                Platform = testConfig.Platform,
                MaxSmbVersionSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported)
            };

            oplockConfig = c;
            Site.Log.Add(LogEntryKind.Debug, oplockConfig.ToString());
        }
Пример #3
0
        public void ReadConfig(out SigningConfig c)
        {
            c = new SigningConfig
            {
                MaxSmbVersionSupported  = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsServerSigningRequired = testConfig.IsServerSigningRequired,
            };

            signingConfig = c;
            Site.Log.Add(LogEntryKind.Debug, signingConfig.ToString());
        }
Пример #4
0
        public void ReadConfig(out CreateCloseConfig c)
        {
            c = new CreateCloseConfig
            {
                MaxSmbVersionServerSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                Platform = testConfig.Platform
            };

            createCloseConfig = c;

            Site.Log.Add(LogEntryKind.Debug, c.ToString());
        }
Пример #5
0
 public void ReadConfig(out SigningConfig c)
 {
     c = new SigningConfig
     {
         MaxSmbVersionSupported  = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
         IsServerSigningRequired = testConfig.IsServerSigningRequired,
     };
     if (testConfig.IsGlobalEncryptDataEnabled && c.MaxSmbVersionSupported >= ModelDialectRevision.Smb30)
     {
         Site.Assert.Inconclusive("This test case is not applicable due to IsGlobalEncryptDataEnabled is True");
     }
     signingConfig = c;
     Site.Log.Add(LogEntryKind.Debug, signingConfig.ToString());
 }
Пример #6
0
        public void ReadConfig(out HandleConfig c)
        {
            c = new HandleConfig
            {
                MaxSmbVersionSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                Platform = testConfig.Platform >= Platform.WindowsServer2016 ? Platform.WindowsServer2012R2 : testConfig.Platform,
                IsPersistentHandleSupported = testConfig.IsPersistentHandlesSupported,
                IsLeasingSupported          = testConfig.IsLeasingSupported,
                IsDirectoryLeasingSupported = testConfig.IsDirectoryLeasingSupported
            };

            handleConfig = c;

            Site.Log.Add(LogEntryKind.Debug, handleConfig.ToString());
        }
Пример #7
0
        public void ReadConfig(out CreditMgmtConfig c)
        {
            uncSharePath = Smb2Utility.GetUncPath(testConfig.SutComputerName, testConfig.BasicFileShare);

            c = new CreditMgmtConfig
            {
                MaxSmbVersionSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                Platform = testConfig.Platform == Platform.WindowsServer2016 ? Platform.WindowsServer2012R2 : testConfig.Platform,
                IsMultiCreditSupportedOnServer = testConfig.IsMultiCreditSupported
            };

            config = c;

            Site.Log.Add(LogEntryKind.Debug, c.ToString());
        }
        /// <summary>
        /// Negotiate, SessionSetup and TreeConnect
        /// </summary>
        public void SetupConnection(ModelDialectRevision dialect, ModelCapabilities capabilities, SecurityMode_Values securityMode)
        {
            #region Connect to server
            testClient = new Smb2FunctionalClient(testConfig.Timeout, testConfig, this.Site);
            testClient.ConnectToServer(testConfig.UnderlyingTransport, testConfig.SutComputerName, testConfig.SutIPAddress);
            #endregion

            // It MUST be a GUID generated by the client, if the Dialects field contains a value other than 0x0202. Otherwise, the client MUST set this to 0.
            Guid clientGuid = (dialect == ModelDialectRevision.Smb2002) ? Guid.Empty : Guid.NewGuid();

            #region negotiate
            testClient.Negotiate(
                Packet_Header_Flags_Values.NONE,
                Smb2Utility.GetDialects(ModelUtility.GetDialectRevision(dialect)),
                securityMode,
                (Capabilities_Values)capabilities,
                clientGuid,
                (header, response) =>
            {
                Site.Assert.AreEqual(Smb2Status.STATUS_SUCCESS, header.Status, "{0} should succeed", header.Command);
                negotiateResponse = response;
            });
            #endregion

            #region session setup
            testClient.SessionSetup(
                testConfig.DefaultSecurityPackage,
                testConfig.SutComputerName,
                testConfig.AccountCredential,
                testConfig.UseServerGssToken,
                (SESSION_SETUP_Request_SecurityMode_Values)securityMode);
            #endregion

            #region treeconnect
            testClient.TreeConnect(
                Smb2Utility.GetUncPath(testConfig.SutComputerName, testConfig.BasicFileShare),
                out treeId);
            #endregion

            Connection_Dialect            = ModelUtility.GetModelDialectRevision(negotiateResponse.DialectRevision);
            Connection_ClientCapabilities = (Capabilities_Values)capabilities;
            if (dialect >= ModelDialectRevision.Smb30) // GLOBAL_CAP_ENCRYPTION will be added in Functional client when dialect >= SMB30
            {
                Connection_ClientCapabilities |= Capabilities_Values.GLOBAL_CAP_ENCRYPTION;
            }
            Connection_ClientSecurityMode = securityMode;
            Connection_ClientGuid         = clientGuid;
        }
        public void ReadConfig(out ResilientHandleServerConfig config)
        {
            resilientHandleConfig = new ResilientHandleServerConfig
            {
                MaxSmbVersionSupported         = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsIoCtlCodeResiliencySupported = testConfig.IsIoCtlCodeSupported(CtlCode_Values.FSCTL_LMR_REQUEST_RESILIENCY),
                Platform = testConfig.Platform >= Platform.WindowsServer2016 ? Platform.WindowsServer2016 : testConfig.Platform
            };
            config = resilientHandleConfig;

            prepareOpenClient = null;
            Site.Log.Add(LogEntryKind.Debug, resilientHandleConfig.ToString());

            // Resilient only applies only to servers that implement the SMB 2.1 or the SMB 3.x dialect family.
            testConfig.CheckDialect(DialectRevision.Smb21);
        }
        public void ReadConfig(out EncryptionConfig c)
        {
            if (!testConfig.IsEncryptionSupported)
            {
                Site.Assert.Inconclusive("This test case is not applicable due to Encryption is not supported");
            }

            c = new EncryptionConfig
            {
                MaxSmbVersionSupported                 = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsGlobalEncryptDataEnabled             = testConfig.IsGlobalEncryptDataEnabled,
                IsGlobalRejectUnencryptedAccessEnabled = testConfig.IsGlobalRejectUnencryptedAccessEnabled,
                Platform = testConfig.Platform == Platform.WindowsServer2016 ? Platform.WindowsServer2012R2 : testConfig.Platform
            };

            encryptionConfig = c;
            Site.Log.Add(LogEntryKind.Debug, encryptionConfig.ToString());
        }
        public void ReadConfig(out ReplayServerConfig c)
        {
            writeContent = Smb2Utility.CreateRandomString(testConfig.WriteBufferLengthInKb);

            c = new ReplayServerConfig
            {
                MaxSmbVersionSupported      = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsDirectoryLeasingSupported = testConfig.IsDirectoryLeasingSupported,
                IsLeasingSupported          = testConfig.IsLeasingSupported,
                IsPersistentHandleSupported = testConfig.IsPersistentHandlesSupported,
                TreeConnect_Share_Type_Include_STYPE_CLUSTER_SOFS = Boolean.Parse(testConfig.GetProperty("ShareTypeInclude_STYPE_CLUSTER_SOFS")),
                Platform = testConfig.Platform,
            };

            replayConfig = c;

            testConfig.CheckDialect(DialectRevision.Smb30);

            Site.Log.Add(LogEntryKind.Debug, c.ToString());
        }
        public void ReadConfig(out SessionMgmtConfig c)
        {
            // TODO: some of these cases could pass when signing is not supported, should enable them in the future.
            testConfig.CheckSigning();

            connectionList = new Dictionary <ModelConnectionId, Smb2FunctionalClient>();
            sessionTable   = new Dictionary <ModelSessionId, ulong>();

            // Adding reserved sessionId to the table for better assignment later
            sessionTable.Add(ModelSessionId.ZeroSessionId, 0);
            sessionTable.Add(ModelSessionId.InvalidSessionId, 0xFFFFFFFFFFFFFFFF);

            PrintCurrentSessionTable("Before Test Start");

            c = new SessionMgmtConfig
            {
                MaxSmbVersionSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported),
                IsMultiChannelCapable  = testConfig.IsMultiChannelCapable,
                Platform = testConfig.Platform == Platform.WindowsServer10 ? Platform.WindowsServer2012R2 : testConfig.Platform
            };

            sessionMgmtConfig = c;
            Site.Log.Add(LogEntryKind.Debug, c.ToString());
        }