public void MSOXCRPC_S01_TC04_TestInvalidParameterpcbOutForEcDoRpcExt2()
{
this.CheckTransport();
#region Client connects with Server
this.pcxh = IntPtr.Zero;
this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
this.pulTimeStamp = 0;
this.returnValue = this.oxcrpcAdapter.EcDoConnectEx(
ref this.pcxh,
TestSuiteBase.UlIcxrLinkForNoSessionLink,
ref this.pulTimeStamp,
null,
this.userDN,
ref this.pcbAuxOut,
this.rgwClientVersion,
out this.rgwBestVersion,
out this.picxr);
Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoConnectEx is the precondition for EcDoRpcExt2 and should succeed. '0' is expected to be returned. The returned value is {0}.", this.returnValue);
#endregion
#region Call EcDoRpcExt2 when pcbOut is equal to SmallpcbOut
// Parameter inObjHandle is no use for RopLogon command, so set it to unUsedInfo.
this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege);
this.pcbOut = ConstValues.SmallpcbOut;
this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
ref this.pcxh,
PulFlags.NoCompression | PulFlags.NoXorMagic,
this.rgbIn,
ref this.pcbOut,
null,
ref this.pcbAuxOut,
out this.response,
ref this.responseSOHTable);
if (Common.IsRequirementEnabled(1924, this.Site))
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1924");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R1924
// The condition that pcbOut is less than 0x00008007 is controlled by constant "SmallpcbOut" defined in ConstValues.cs.
Site.CaptureRequirementIfAreEqual<uint>(
0x000004B6,
this.returnValue,
1924,
@"[In Appendix B: Product Behavior] Implementation does fail with ecRpcFormat (0x000004B6) if the output buffer is less than 0x00008007. (Microsoft Exchange Server 2007 follows this behavior).");
}
#endregion
#region Client disconnects with Server
if (this.pcxh != IntPtr.Zero)
{
this.returnValue = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh);
Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoDisconnect should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
}
#endregion
// Wait one second before sending next invalid request to avoid many invalid requests received by server in short time.
System.Threading.Thread.Sleep(1000);
#region Client connects with Server
this.pcxh = IntPtr.Zero;
this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
this.pulTimeStamp = 0;
this.returnValue = this.oxcrpcAdapter.EcDoConnectEx(
ref this.pcxh,
TestSuiteBase.UlIcxrLinkForNoSessionLink,
ref this.pulTimeStamp,
null,
this.userDN,
ref this.pcbAuxOut,
this.rgwClientVersion,
out this.rgwBestVersion,
out this.picxr);
Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoConnectEx is the precondition for EcDoRpcExt2 and should succeed. '0' is expected to be returned. The returned value is {0}.", this.returnValue);
#endregion
#region Call EcDoRpcExt2 when pcbOut is equal to TooSmallpcbOut
// Parameter inObjHandle is no use for RopLogon command, so set it to unUsedInfo.
this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege);
this.pcbOut = ConstValues.TooSmallpcbOut;
this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
ref this.pcxh,
PulFlags.NoCompression | PulFlags.NoXorMagic,
this.rgbIn,
ref this.pcbOut,
null,
ref this.pcbAuxOut,
out this.response,
ref this.responseSOHTable);
#endregion
#region Capture code.
if (Common.IsRequirementEnabled(664, this.Site))
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R664");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R664
// The condition that pcbOut is less than 0x00000008 is controlled by constant "TooSmallpcbOut" defined in ConstValues.cs.
Site.CaptureRequirementIfAreEqual<uint>(
0x80040115,
this.returnValue,
664,
@"[In Appendix B: Product Behavior] Implementation does fail with error code ecRpcFailed (0x80040115) if the value in pcbOut on input is less than 0x00000008. (Microsoft Exchange Server 2010 follows this behavior).");
}
if (Common.IsRequirementEnabled(2002, this.Site))
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R2002");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R2002
// The condition that pcbOut is less than 0x00000008 is controlled by constant "TooSmallpcbOut" defined in ConstValues.cs.
Site.CaptureRequirementIfAreEqual<uint>(
0x00000000,
this.returnValue,
2002,
@"[In Appendix B: Product Behavior] Implementation does succeed if output buffer is less than 0x00000008, but no request ROPs will have been processed. (Microsoft Exchange Server 2013 and Microsoft Exchange Server 2016 follow this behavior).");
}
if (Common.IsRequirementEnabled(1900, this.Site))
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R1900");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R1900
// The condition that cbIn is less than 0x00000008 is controlled by constant "TooSmallpcbOut" defined in ConstValues.cs.
Site.CaptureRequirementIfAreEqual<uint>(
0x000004B6,
this.returnValue,
1900,
@"[In Appendix B: Product Behavior] Implementation does fail with error code ecRpcFormat (0x000004B6) if the value in pcbOut is less than 0x00000008. (<20> Section 3.1.4.2: Exchange 2007, and Microsoft Exchange Server 2010 Service Pack 1 (SP1) fail with error code ecRpcFormat (0x000004B6) if the value in the cbIn parameter is less than 0x00000008. )");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R697");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R697
Site.CaptureRequirementIfAreEqual<uint>(
0x000004B6,
this.returnValue,
697,
@"[In EcDoRpcExt2 Method (opnum 11)] [Return Values] [ecRpcFormat (0x000004B6)] The format of the request was found to be invalid.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R698");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R698
Site.CaptureRequirementIfAreEqual<uint>(
0x000004B6,
this.returnValue,
698,
@"[In EcDoRpcExt2 Method (opnum 11)] [Return Values] [ecRpcFormat (0x000004B6)] This [ecRpcFormat] is a generic error that means the length was found to be invalid or the content was found to be invalid.");
}
#endregion
#region Client disconnects with Server
if (this.pcxh != IntPtr.Zero)
{
this.returnValue = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh);
Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoDisconnect should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
}
#endregion
// Wait one second before sending next invalid request to avoid many invalid requests received by server in short time.
System.Threading.Thread.Sleep(1000);
#region Client connects with Server
this.pcxh = IntPtr.Zero;
this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
this.pulTimeStamp = 0;
this.returnValue = this.oxcrpcAdapter.EcDoConnectEx(
ref this.pcxh,
TestSuiteBase.UlIcxrLinkForNoSessionLink,
ref this.pulTimeStamp,
null,
this.userDN,
ref this.pcbAuxOut,
this.rgwClientVersion,
out this.rgwBestVersion,
out this.picxr);
Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoConnectEx is the precondition for EcDoRpcExt2 and should succeed. '0' is expected to be returned. The returned value is {0}.", this.returnValue);
#endregion
#region Call EcDoRpcExt2 when pcbOut is equal to TooBigpcbOut
this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege);
this.pcbOut = ConstValues.TooBigpcbOut;
this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
ref this.pcxh,
PulFlags.NoCompression | PulFlags.NoXorMagic,
this.rgbIn,
ref this.pcbOut,
null,
ref this.pcbAuxOut,
out this.response,
ref this.responseSOHTable);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCRPC_R666");
// Verify MS-OXCRPC requirement: MS-OXCRPC_R666
// The condition that pcbOut is larger than 0x00040000 is controlled by constant "TooBigpcbOut" defined in ConstValues.cs.
Site.CaptureRequirementIfAreEqual<uint>(
0x000006F7,
this.returnValue,
666,
@"[In EcDoRpcExt2 Method (opnum 11)] [pcbOut] If the value in the pcbOut parameter on input is larger than 0x00040000, the server MUST fail with the RPC status code of RPC_X_BAD_STUB_DATA (0x000006F7).");
#endregion
#region Client disconnects with Server
if (this.pcxh != IntPtr.Zero)
{
this.returnValue = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh);
Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoDisconnect should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
}
#endregion
}