The following comments were made in dotnet/corefx#6469 and need to be incorporated into negotiatestream
1. One to one mapping with native calls and Interop.*.cs files
This is a lot of code being added to the Interop.*.cs files. Typically we've kept these as close to 1:1 with the underlying operation being wrapped as possible, typiclaly just the P/Invoke signature or maybe a 1-2 line wrapper if necessary, and then all of this additional logic ends up living in the consuming code.
2. Split up safefreecredentials
As post-merge cleanup this file should probably be split up (now that this base class applies to two different libraries' interop). And since libssl is the last lib* directory left in Interop, that could be cleaned up at the same time.
3. Fix up boiler plate code in KerberosTest.cs
I honestly can't figure out how each of these tests is different... it'd be great to factor out boilerplate and leave each test showing the kernel of what it's testing. (fixed in dotnet/corefx#7317)
4. Non-SafeHandle SafeHandles to be refactored out
Some of the safehandles in PAL are not really safe handles. These need to reworked.
Not today, but one day it would give me a warm and fuzzy feeling if the PAL was reworked to not require non-SafeHandle SafeHandles be created.
5. A compile time constant for the size of OID lengths
The following code has /magic/ value of 6.
gss_OID_desc gss_mech_spnego_OID_desc = {.length = 6, .elements = static_cast<void*>(gss_spnego_oid_value)};
6. Debug only constructor with an assert for size (fixed in dotnet/corefx#7317)
private const int StatusDictionarySize = 39;
#if DEBUG
static SecurityStatusAdapterPal()
{
Debug.Assert(s_statusDictionary.Count == StatusDictionarySize, $"Expected size {StatusDictionarySize}, got size {s_statusDictionary.Count}");
}
#endif
private static readonly ... = new BidirectionDictionary<...>(StatusDictionarySize);
The following comments were made in dotnet/corefx#6469 and need to be incorporated into negotiatestream
1. One to one mapping with native calls and Interop.*.cs filesThis is a lot of code being added to the Interop.*.cs files. Typically we've kept these as close to 1:1 with the underlying operation being wrapped as possible, typiclaly just the P/Invoke signature or maybe a 1-2 line wrapper if necessary, and then all of this additional logic ends up living in the consuming code.
2. Split up safefreecredentialsAs post-merge cleanup this file should probably be split up (now that this base class applies to two different libraries' interop). And since libssl is the last lib* directory left in Interop, that could be cleaned up at the same time.
3. Fix up boiler plate code in KerberosTest.cs(fixed in dotnet/corefx#7317)I honestly can't figure out how each of these tests is different... it'd be great to factor out boilerplate and leave each test showing the kernel of what it's testing.
4. Non-SafeHandle SafeHandles to be refactored outSome of the safehandles in PAL are not really safe handles. These need to reworked.
5. A compile time constant for the size of OID lengthsThe following code has /magic/ value of 6.
6. Debug only constructor with an assert for size(fixed in dotnet/corefx#7317)