Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

RC2: Porting SslStream <Read|Write>Async overrides and regression fix #5691

Merged
merged 2 commits into from
Jan 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ internal unsafe SslConnectionInfo(byte[] nativeBuffer)
{
GlobalLog.Assert("SslConnectionInfo::.ctor", "Negative size.");
}

Debug.Fail("SslConnectionInfo::.ctor", "Negative size.");
throw;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public unsafe int DecryptMessage(SafeDeleteContext context, Interop.SspiCli.Secu
context.DangerousRelease();
}


if (status == 0 && qop == Interop.SspiCli.SECQOP_WRAP_NO_ENCRYPT)
{
if (GlobalLog.IsEnabled)
{
GlobalLog.Assert("SspiCli.DecryptMessage", "Expected qop = 0, returned value = " + qop.ToString("x", CultureInfo.InvariantCulture));
}

Debug.Fail("SspiCli.DecryptMessage", "Expected qop = 0, returned value = " + qop.ToString("x", CultureInfo.InvariantCulture));
throw new InvalidOperationException(SR.net_auth_message_not_encrypted);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ private unsafe static int EncryptDecryptHelper(OP op, SSPIInterface secModule, S
{
GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Unknown OP: " + op);
}

Debug.Fail("SSPIWrapper::EncryptDecryptHelper", "Unknown OP: " + op);
throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
}
Expand Down Expand Up @@ -458,6 +459,7 @@ private unsafe static int EncryptDecryptHelper(OP op, SSPIInterface secModule, S
{
GlobalLog.Assert("SSPIWrapper::EncryptDecryptHelper", "Output buffer out of range.");
}

Debug.Fail("SSPIWrapper::EncryptDecryptHelper", "Output buffer out of range.");
iBuffer.size = 0;
iBuffer.offset = 0;
Expand All @@ -473,14 +475,17 @@ private unsafe static int EncryptDecryptHelper(OP op, SSPIInterface secModule, S
{
GlobalLog.AssertFormat("SSPIWrapper::EncryptDecryptHelper|'offset' out of range. [{0}]", iBuffer.offset);
}

Debug.Fail("SSPIWrapper::EncryptDecryptHelper|'offset' out of range. [" + iBuffer.offset + "]");
}

if (iBuffer.size < 0 || iBuffer.size > (iBuffer.token == null ? 0 : iBuffer.token.Length - iBuffer.offset))
{
if (GlobalLog.IsEnabled)
{
GlobalLog.AssertFormat("SSPIWrapper::EncryptDecryptHelper|'size' out of range. [{0}]", iBuffer.size);
}

Debug.Fail("SSPIWrapper::EncryptDecryptHelper|'size' out of range. [" + iBuffer.size + "]");
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Common/src/Interop/Windows/sspicli/SecSizes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal unsafe SecSizes(byte[] memory)
{
GlobalLog.Assert("SecSizes::.ctor", "Negative size.");
}

Debug.Fail("SecSizes::.ctor", "Negative size.");
throw;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ internal unsafe static int InitializeSecurityContext(
{
GlobalLog.Assert("SafeDeleteContext::InitializeSecurityContext()|outSecBuffer != null");
}

Debug.Fail("SafeDeleteContext::InitializeSecurityContext()|outSecBuffer != null");
}
if (inSecBuffer != null && inSecBuffers != null)
Expand All @@ -557,6 +558,7 @@ internal unsafe static int InitializeSecurityContext(
{
GlobalLog.Assert("SafeDeleteContext::InitializeSecurityContext()|inSecBuffer == null || inSecBuffers == null");
}

Debug.Fail("SafeDeleteContext::InitializeSecurityContext()|inSecBuffer == null || inSecBuffers == null");
}

Expand Down Expand Up @@ -859,6 +861,7 @@ internal unsafe static int AcceptSecurityContext(
{
GlobalLog.Assert("SafeDeleteContext::AcceptSecurityContext()|outSecBuffer != null");
}

Debug.Fail("SafeDeleteContext::AcceptSecurityContext()|outSecBuffer != null");
}
if (inSecBuffer != null && inSecBuffers != null)
Expand All @@ -867,6 +870,7 @@ internal unsafe static int AcceptSecurityContext(
{
GlobalLog.Assert("SafeDeleteContext::AcceptSecurityContext()|inSecBuffer == null || inSecBuffers == null");
}

Debug.Fail("SafeDeleteContext::AcceptSecurityContext()|outSecBuffer != null");
}

Expand Down Expand Up @@ -1142,6 +1146,7 @@ internal unsafe static int CompleteAuthToken(
{
GlobalLog.Assert("SafeDeleteContext::CompleteAuthToken()|inSecBuffers == null");
}

Debug.Fail("SafeDeleteContext::CompleteAuthToken()|inSecBuffers == null");
}

Expand Down
1 change: 1 addition & 0 deletions src/Common/src/Interop/Windows/sspicli/StreamSizes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ internal unsafe StreamSizes(byte[] memory)
{
GlobalLog.Assert("StreamSizes::.ctor", "Negative size.");
}

Debug.Fail("StreamSizes::.ctor", "Negative size.");
throw;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Common/src/System/Net/ContextAwareResult.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ internal WindowsIdentity Identity
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::Identity|Called on completed result.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::Identity |Called on completed result.");
}

Expand All @@ -49,6 +50,7 @@ internal WindowsIdentity Identity
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::Identity|No identity captured - specify captureIdentity.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::Identity |No identity captured - specify captureIdentity.");
}

Expand All @@ -62,8 +64,10 @@ internal WindowsIdentity Identity
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::Identity|Must lock (StartPostingAsyncOp()) { ... FinishPostingAsyncOp(); } when calling Identity (unless it's only called after FinishPostingAsyncOp).", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::Identity |Must lock (StartPostingAsyncOp()) { ... FinishPostingAsyncOp(); } when calling Identity (unless it's only called after FinishPostingAsyncOp).");
}

lock (_lock) { }
}

Expand All @@ -75,6 +79,7 @@ internal WindowsIdentity Identity
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::Identity|Result became completed during call.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::Identity |Result became completed during call.");
}

Expand Down
7 changes: 7 additions & 0 deletions src/Common/src/System/Net/ContextAwareResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ internal ExecutionContext ContextCopy
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::ContextCopy|Called on completed result.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::ContextCopy |Called on completed result.");
}

Expand All @@ -157,6 +158,7 @@ internal ExecutionContext ContextCopy
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::ContextCopy|No context captured - specify a callback or forceCaptureContext.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::ContextCopy |No context captured - specify a callback or forceCaptureContext.");
}

Expand All @@ -170,6 +172,7 @@ internal ExecutionContext ContextCopy
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::ContextCopy|Must lock (StartPostingAsyncOp()) { ... FinishPostingAsyncOp(); } when calling ContextCopy (unless it's only called after FinishPostingAsyncOp).", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) +"::ContextCopy |Must lock (StartPostingAsyncOp()) { ... FinishPostingAsyncOp(); } when calling ContextCopy (unless it's only called after FinishPostingAsyncOp).");
}
lock (_lock) { }
Expand All @@ -183,6 +186,7 @@ internal ExecutionContext ContextCopy
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::ContextCopy|Result became completed during call.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::ContextCopy |Result became completed during call.");
}

Expand Down Expand Up @@ -221,6 +225,7 @@ internal object StartPostingAsyncOp(bool lockCapture)
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::StartPostingAsyncOp|Called on completed result.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::StartPostingAsyncOp |Called on completed result.");
}

Expand Down Expand Up @@ -318,6 +323,7 @@ private bool CaptureOrComplete(ref ExecutionContext cachedContext, bool returnCo
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::CaptureOrComplete|Called without calling StartPostingAsyncOp.", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::CaptureOrComplete |Called without calling StartPostingAsyncOp.");
}

Expand Down Expand Up @@ -384,6 +390,7 @@ private bool CaptureOrComplete(ref ExecutionContext cachedContext, bool returnCo
{
GlobalLog.AssertFormat("ContextAwareResult#{0}::CaptureOrComplete|Didn't capture context, but didn't complete synchronously!", LoggingHash.HashString(this));
}

Debug.Fail("ContextAwareResult#" + LoggingHash.HashString(this) + "::CaptureOrComplete |Didn't capture context, but didn't complete synchronously!");
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Common/src/System/Net/InternalException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal InternalException()
{
GlobalLog.Assert("InternalException thrown.");
}

Debug.Fail("InternalException thrown.");
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Common/src/System/Net/LazyAsyncResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ internal LazyAsyncResult(object myObject, object myState, AsyncCallback myCallBa
{
GlobalLog.AssertFormat("LazyAsyncResult#{0}::.ctor()|Result can't be set to DBNull - it's a special internal value.", LoggingHash.HashString(this));
}

Debug.Fail("LazyAsyncResult#" + LoggingHash.HashString(this) + "::.ctor()|Result can't be set to DBNull - it's a special internal value.");
}

Expand Down Expand Up @@ -335,14 +336,17 @@ internal object Result
{
GlobalLog.AssertFormat("LazyAsyncResult#{0}::set_Result()|Result can't be set to DBNull - it's a special internal value.", LoggingHash.HashString(this));
}

Debug.Fail("LazyAsyncResult#" + LoggingHash.HashString(this) + "::set_Result()|Result can't be set to DBNull - it's a special internal value.");
}

if (InternalPeekCompleted)
{
if (GlobalLog.IsEnabled)
{
GlobalLog.AssertFormat("LazyAsyncResult#{0}::set_Result()|Called on completed result.", LoggingHash.HashString(this));
}

Debug.Fail("LazyAsyncResult#" + LoggingHash.HashString(this) + "::set_Result()|Called on completed result.");
}
_result = value;
Expand Down
32 changes: 16 additions & 16 deletions src/System.Net.Security/System.Net.Security.sln
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ Global
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Debug|Any CPU.Build.0 = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Release|Any CPU.ActiveCfg = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Release|Any CPU.Build.0 = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Debug|Any CPU.Build.0 = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Release|Any CPU.ActiveCfg = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Release|Any CPU.Build.0 = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Release|Any CPU.Build.0 = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Debug|Any CPU.Build.0 = Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Release|Any CPU.ActiveCfg = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Release|Any CPU.Build.0 = Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Debug|Any CPU.ActiveCfg = Linux_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Debug|Any CPU.Build.0 = Linux_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Release|Any CPU.ActiveCfg = Linux_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Linux_Release|Any CPU.Build.0 = Linux_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Debug|Any CPU.ActiveCfg = OSX_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Debug|Any CPU.Build.0 = OSX_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Release|Any CPU.ActiveCfg = OSX_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.OSX_Release|Any CPU.Build.0 = OSX_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Release|Any CPU.Build.0 = Windows_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Linux_Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ internal static string[] GetRequestCertificateAuthorities(SafeDeleteContext secu
{
GlobalLog.Assert("SecureChannel::GetIssuers()", "Interop.SspiCli._CERT_CHAIN_ELEMENT size is not positive: " + pIL2->cbSize.ToString());
}

Debug.Fail("SecureChannel::GetIssuers()", "Interop.SspiCli._CERT_CHAIN_ELEMENT size is not positive: " + pIL2->cbSize.ToString());
}

Expand Down Expand Up @@ -254,6 +255,7 @@ internal static X509Store EnsureStoreOpened(bool isMachineStore)
{
GlobalLog.Assert("SecureChannel::EnsureStoreOpened()", "Failed to open cert store, location:" + storeLocation + " exception:" + exception);
}

Debug.Fail("SecureChannel::EnsureStoreOpened()", "Failed to open cert store, location:" + storeLocation + " exception:" + exception);
return null;
}
Expand Down
Loading