Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change | Simplify Conditional File Inclusion #2425

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System;
using System.Runtime.InteropServices;

Expand All @@ -13,3 +15,5 @@ internal partial class Kernel32
internal static extern bool CloseHandle(IntPtr handle);
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

internal static partial class Interop
{
internal static partial class Libraries
Expand All @@ -10,3 +12,5 @@ internal static partial class Libraries
internal const string NetSecurityNative = "System.Net.Security.Native";
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.Data;
#if !NET8_0_OR_GREATER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this part of the code System.Net.Security is not being used on Unix when using Net7+. The driver is using the newly added API from #2063. Basically this part of the code could be deleted when support for net6 is over.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. There is several files that have !NET8_0_OR_GREATER in this PR, so theoretically they can be removed once net6 support is over. As for now, they should stay, right?


using System;
using System.Runtime.InteropServices;
using Microsoft.Data;

internal static partial class Interop
{
Expand Down Expand Up @@ -56,3 +58,5 @@ private static string GetGssApiDisplayStatus(Status status, bool isMinor)
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.Data;
#if !NET8_0_OR_GREATER

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Data;

internal static partial class Interop
{
Expand Down Expand Up @@ -74,3 +76,5 @@ static GssBuffer()
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;

Expand Down Expand Up @@ -126,3 +127,5 @@ static NetSecurityNative()
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System;
using System.Runtime.InteropServices;

Expand All @@ -24,3 +26,5 @@ internal static extern bool CertVerifyCertificateChainPolicy(
[In, Out] ref CERT_CHAIN_POLICY_STATUS pPolicyStatus);
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -125,3 +127,5 @@ internal unsafe struct CERT_CHAIN_POLICY_STATUS
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

internal static partial class Interop
{
internal enum SECURITY_STATUS
Expand Down Expand Up @@ -358,3 +360,5 @@ internal static string MapSecurityStatus(uint statusCode)
}
#endif // TRACE_VERBOSE
}

#endif // !NET8_OR_GREATER
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand Down Expand Up @@ -45,3 +46,5 @@ internal unsafe SecPkgContext_ConnectionInfo(byte[] nativeBuffer)
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

namespace System.Net
{
internal static class GlobalSSPI
Expand All @@ -10,3 +12,5 @@ internal static class GlobalSSPI
internal static readonly SSPIInterface SSPISecureChannel = new SSPISecureChannelType();
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System;
using System.Net.Security;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -388,3 +390,5 @@ internal static extern unsafe SECURITY_STATUS SspiEncodeStringsAsAuthIdentity(
[Out] out SafeSspiAuthDataHandle authData);
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand Down Expand Up @@ -59,3 +61,5 @@ internal NegotiationInfoClass(SafeHandle safeHandle, int negotiationState)
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Net.Security;
using System.Runtime.InteropServices;
using Microsoft.Data;
Expand Down Expand Up @@ -199,3 +201,5 @@ public int ApplyControlToken(ref SafeDeleteContext refContext, SecurityBuffer[]
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Net.Security;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -30,3 +32,5 @@ internal interface SSPIInterface
int ApplyControlToken(ref SafeDeleteContext refContext, SecurityBuffer[] inputBuffers);
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Net.Security;
using System.Runtime.InteropServices;
using Microsoft.Data;
Expand Down Expand Up @@ -155,3 +157,5 @@ public int ApplyControlToken(ref SafeDeleteContext refContext, SecurityBuffer[]
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.ComponentModel;
using System.Globalization;
using System.Net.Security;
Expand Down Expand Up @@ -595,3 +597,5 @@ public static string ErrorDescription(int errorCode)
}
} // class SSPIWrapper
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.Win32.SafeHandles;
#if !NET8_0_OR_GREATER

using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Authentication.ExtendedProtection;

namespace System.Net.Security
{
Expand Down Expand Up @@ -53,3 +51,5 @@ public override string ToString()
#endif
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand All @@ -14,3 +16,5 @@ internal struct SecPkgContext_Bindings
internal IntPtr Bindings;
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand All @@ -14,3 +16,5 @@ internal struct SecPkgContext_NegotiationInfoW
internal uint NegotiationState;
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand Down Expand Up @@ -40,3 +41,5 @@ internal unsafe SecPkgContext_Sizes(byte[] memory)
public static readonly int SizeOf = Marshal.SizeOf<SecPkgContext_Sizes>();
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand Down Expand Up @@ -42,3 +43,5 @@ internal unsafe SecPkgContext_StreamSizes(byte[] memory)
public static readonly int SizeOf = Marshal.SizeOf<SecPkgContext_StreamSizes>();
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Runtime.InteropServices;

namespace System.Net
Expand All @@ -18,3 +20,5 @@ internal struct SecurityPackageInfo
internal IntPtr Comment;
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System.Globalization;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -76,3 +78,5 @@ public override string ToString()
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.Win32.SafeHandles;
#if !NET8_0_OR_GREATER

using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security.Authentication.ExtendedProtection;
using Microsoft.Win32.SafeHandles;

namespace System.Net.Security
{
Expand Down Expand Up @@ -1279,3 +1280,5 @@ protected override bool ReleaseHandle()
}
}
}

#endif // !NET8_OR_GREATER
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !NET8_0_OR_GREATER

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -135,3 +137,5 @@ protected override bool ReleaseHandle()
}
}
}

#endif
Loading
Loading