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()); }
public static void ReadConfigReturn(CreditMgmtConfig c) { Condition.IsTrue(state == ModelState.Uninitialized); Condition.IsNotNull(c); Condition.IsTrue( c.MaxSmbVersionSupported == ModelDialectRevision.Smb2002 || c.MaxSmbVersionSupported == ModelDialectRevision.Smb21 || c.MaxSmbVersionSupported == ModelDialectRevision.Smb30 || c.MaxSmbVersionSupported == ModelDialectRevision.Smb302); negotiateDialect = DialectRevision.Smb2Unknown; config = c; request = null; state = ModelState.Initialized; acceptingCondition = false; }
public static void CreditOperationResponse(ModelSmb2Status status, uint creditResponse, CreditMgmtConfig c) { Condition.IsTrue(state == ModelState.Connected); Condition.IsTrue(c.Platform == config.Platform); ModelCreditOperationRequest creditOperationRequest = ModelHelper.RetrieveOutstandingRequest<ModelCreditOperationRequest>(ref request); if (config.Platform != Platform.NonWindows) { if (creditOperationRequest.creditRequestNum == ModelCreditRequestNum.CreditRequestSetNonZero) { ModelHelper.Log( LogType.Requirement, "3.3.1.2: The server SHOULD<151> grant the client a non-zero value of credits in response to any non-zero value requested"); ModelHelper.Log( LogType.TestInfo, "Platform is {0}", config.Platform); Condition.IsTrue(creditResponse != 0); } } if (creditOperationRequest.midType == ModelMidType.UsedMid || creditOperationRequest.midType == ModelMidType.UnavailableMid || (isMultiCreditSupported && creditOperationRequest.creditCharge == ModelCreditCharge.CreditChargeExceedBoundary)) { ModelHelper.Log( LogType.Requirement, "3.3.5.2.3: If the server determines that the MessageId or the range of MessageIds for the incoming request is not valid," + " the server SHOULD<202> terminate the connection. Otherwise, the server MUST remove the MessageId or the range of MessageIds from the Connection.CommandSequenceWindow."); if (creditOperationRequest.midType == ModelMidType.UsedMid || creditOperationRequest.midType == ModelMidType.UnavailableMid) { ModelHelper.Log(LogType.TestTag, TestTag.InvalidIdentifier); } if (isMultiCreditSupported && creditOperationRequest.creditCharge == ModelCreditCharge.CreditChargeExceedBoundary) { ModelHelper.Log(LogType.TestTag, TestTag.OutOfBoundary); } //Only NonWindows would run into this case when not following the SHOULD requirement Condition.IsTrue(config.Platform == Platform.NonWindows); Condition.IsTrue(status != ModelSmb2Status.STATUS_SUCCESS); acceptingCondition = true; return; } if (isMultiCreditSupported) { ModelHelper.Log( LogType.Requirement, "3.3.5.2.5: If Connection.SupportsMultiCredit is TRUE," + " the server MUST verify the CreditCharge field in the SMB2 header and the payload size (the size of the data within the variable-length field) of the request or the maximum response size"); ModelHelper.Log( LogType.TestInfo, "Connection.SupportsMultiCredit is TRUE"); if (creditOperationRequest.creditCharge == ModelCreditCharge.CreditChargeSetZero) { //NOTE: When multi-credit request is not supported or credit charge = 0 // Treat PayloadSize > 64K if use "LargerThanCreditCharge" if (creditOperationRequest.payloadSize == ModelPayloadSize.PayloadSizeLargerThanBoundary) { ModelHelper.Log( LogType.Requirement, "If CreditCharge is zero and the payload size of the request or the maximum response size is greater than 64 kilobytes," + " the server MUST fail the request with the error code STATUS_INVALID_PARAMETER."); ModelHelper.Log( LogType.TestInfo, "Credit charge type in request is {0}, payload size type is {1}", creditOperationRequest.creditCharge, creditOperationRequest.payloadSize); ModelHelper.Log(LogType.TestTag, TestTag.OutOfBoundary); Condition.IsTrue(status == ModelSmb2Status.STATUS_INVALID_PARAMETER); acceptingCondition = true; //Reaching an accepting condition of exploration return; } } else { if (creditOperationRequest.payloadSize == ModelPayloadSize.PayloadSizeLargerThanBoundary) { ModelHelper.Log( LogType.Requirement, "If CreditCharge is greater than zero, the server MUST calculate the expected CreditCharge for the current operation using the formula specified in section 3.1.5.2." + " If the calculated credit number is greater than the CreditCharge, the server MUST fail the request with the error code STATUS_INVALID_PARAMETER."); ModelHelper.Log( LogType.TestInfo, "Credit charge type in request is {0}, payload size type is {1}," + " that's calculated credit number based on payload size is greater than the CreditCharge", creditOperationRequest.creditCharge, creditOperationRequest.payloadSize); ModelHelper.Log(LogType.TestTag, TestTag.OutOfBoundary); Condition.IsTrue(status == ModelSmb2Status.STATUS_INVALID_PARAMETER); acceptingCondition = true; //Reaching an accepting condition of exploration return; } } } Condition.IsTrue(status == ModelSmb2Status.STATUS_SUCCESS); acceptingCondition = true; }
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.WindowsServer10 ? Platform.WindowsServer2012R2 : testConfig.Platform, IsMultiCreditSupportedOnServer = testConfig.IsMultiCreditSupported }; config = c; Site.Log.Add(LogEntryKind.Debug, c.ToString()); }