Skip to content

Commit

Permalink
Removed references to CTAIP and client certificate authentication (#2831
Browse files Browse the repository at this point in the history
)
  • Loading branch information
edwardneal authored Oct 7, 2024
1 parent 4e118ae commit 9433389
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 655 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
<GenerateAssemblyAttribute>true</GenerateAssemblyAttribute>
<RawClDefines>$(RawClDefines);SUPPRESS_SECURITY_RULES=1</RawClDefines>
<!-- ADO.NET internal defines -->
<UseOwnAssemblyVersionOnly Condition="'$(AdoNetService)'=='true'">true</UseOwnAssemblyVersionOnly>
<DefineConstants Condition="'$(AdoNetService)'=='true'">$(DefineConstants);ADONET_SERVICE;ADONET_CERT_AUTH;ADONET_ORIGINAL_CLIENT_ADDRESS</DefineConstants>
<ComCompatibleSideBySide>True</ComCompatibleSideBySide>
<GenerateTargetFrameworkAttribute>False</GenerateTargetFrameworkAttribute>
</PropertyGroup>
Expand Down Expand Up @@ -706,8 +704,6 @@
<Compile Include="Microsoft\Data\SqlClient\Server\TriggerAction.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlBuffer.netfx.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlBulkCopy.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlCertificateCallbacks.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlClientOriginalAddressInfo.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlClientPermission.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlClientWrapperSmiStream.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlClientWrapperSmiStreamChars.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ internal static class SNINativeManagedWrapperARM64
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref SNICTAIPProviderInfo pInfo);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref AuthProviderInfo pInfo);

Expand Down Expand Up @@ -132,9 +129,6 @@ internal static extern unsafe uint SNISecGenClientContextWrapper(
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIWriteSyncOverAsync(SNIHandle pConn, [In] SNIPacket pPacket);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr SNIClientCertificateFallbackWrapper(IntPtr pCallbackContext);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIServerEnumOpenWrapper")]
internal static extern IntPtr SNIServerEnumOpen();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ internal static class SNINativeManagedWrapperX64
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref SNICTAIPProviderInfo pInfo);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref AuthProviderInfo pInfo);

Expand Down Expand Up @@ -132,9 +129,6 @@ internal static extern unsafe uint SNISecGenClientContextWrapper(
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIWriteSyncOverAsync(SNIHandle pConn, [In] SNIPacket pPacket);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr SNIClientCertificateFallbackWrapper(IntPtr pCallbackContext);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIServerEnumOpenWrapper")]
internal static extern IntPtr SNIServerEnumOpen();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ internal static class SNINativeManagedWrapperX86
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref SNICTAIPProviderInfo pInfo);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIAddProviderWrapper")]
internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref AuthProviderInfo pInfo);

Expand Down Expand Up @@ -132,9 +129,6 @@ internal static extern unsafe uint SNISecGenClientContextWrapper(
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern uint SNIWriteSyncOverAsync(SNIHandle pConn, [In] SNIPacket pPacket);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr SNIClientCertificateFallbackWrapper(IntPtr pCallbackContext);

[DllImport(SNI, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SNIServerEnumOpenWrapper")]
internal static extern IntPtr SNIServerEnumOpen();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,6 @@ internal struct AuthProviderInfo
public string serverCertFileName;
};

internal struct CTAIPProviderInfo
{
internal byte[] originalNetworkAddress;
internal Boolean fromDataSecurityProxy;
};

struct SNIAuthProviderInfoWrapper
{
internal object pDelegateContext;
internal SqlClientCertificateDelegate pSqlClientCertificateDelegate;
};

internal struct SNICTAIPProviderInfo
{
internal SNIHandle pConn;
internal byte prgbAddress;
internal ulong cbAddress;
internal bool fFromDataSecurityProxy;
};

[StructLayout(LayoutKind.Sequential)]
internal struct CredHandle
{
Expand Down Expand Up @@ -418,21 +398,6 @@ internal static uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In]
}
}

internal static uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref SNICTAIPProviderInfo pInfo)
{
switch (s_architecture)
{
case System.Runtime.InteropServices.Architecture.Arm64:
return SNINativeManagedWrapperARM64.SNIAddProviderWrapper(pConn, ProvNum, ref pInfo);
case System.Runtime.InteropServices.Architecture.X64:
return SNINativeManagedWrapperX64.SNIAddProviderWrapper(pConn, ProvNum, ref pInfo);
case System.Runtime.InteropServices.Architecture.X86:
return SNINativeManagedWrapperX86.SNIAddProviderWrapper(pConn, ProvNum, ref pInfo);
default:
throw ADP.SNIPlatformNotSupported(s_architecture.ToString());
}
}

internal static uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref AuthProviderInfo pInfo)
{
switch (s_architecture)
Expand Down Expand Up @@ -943,21 +908,6 @@ private static uint SNIWriteSyncOverAsync(SNIHandle pConn, [In] SNIPacket pPacke
throw ADP.SNIPlatformNotSupported(s_architecture.ToString());
}
}

private static IntPtr SNIClientCertificateFallbackWrapper(IntPtr pCallbackContext)
{
switch (s_architecture)
{
case System.Runtime.InteropServices.Architecture.Arm64:
return SNINativeManagedWrapperARM64.SNIClientCertificateFallbackWrapper(pCallbackContext);
case System.Runtime.InteropServices.Architecture.X64:
return SNINativeManagedWrapperX64.SNIClientCertificateFallbackWrapper(pCallbackContext);
case System.Runtime.InteropServices.Architecture.X86:
return SNINativeManagedWrapperX86.SNIClientCertificateFallbackWrapper(pCallbackContext);
default:
throw ADP.SNIPlatformNotSupported(s_architecture.ToString());
}
}
#endregion

internal static uint SNISecGetServerCertificate(SNIHandle pConnectionObject, ref X509Certificate2 certificate)
Expand Down Expand Up @@ -1185,16 +1135,8 @@ internal static uint SNIAddProvider(SNIHandle pConn,
{
UInt32 ret;
uint ERROR_SUCCESS = 0;
SNIAuthProviderInfoWrapper sniAuthInfoWrapper;

if (authInfo.clientCertificateCallback != null)
{
sniAuthInfoWrapper.pDelegateContext = authInfo.clientCertificateCallbackContext;
sniAuthInfoWrapper.pSqlClientCertificateDelegate = authInfo.clientCertificateCallback;

authInfo.clientCertificateCallbackContext = sniAuthInfoWrapper;
authInfo.clientCertificateCallback = SNIClientCertificateFallbackWrapper;
}
Debug.Assert(authInfo.clientCertificateCallback == null, "CTAIP support has been removed");

ret = SNIAddProviderWrapper(pConn, providerEnum, ref authInfo);

Expand All @@ -1208,34 +1150,6 @@ internal static uint SNIAddProvider(SNIHandle pConn,
return ret;
}

[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
internal static uint SNIAddProvider(SNIHandle pConn,
ProviderEnum providerEnum,
CTAIPProviderInfo authInfo)
{
UInt32 ret;
uint ERROR_SUCCESS = 0;


SNICTAIPProviderInfo ctaipInfo = new SNICTAIPProviderInfo();

ctaipInfo.prgbAddress = authInfo.originalNetworkAddress[0];
ctaipInfo.cbAddress = (byte)authInfo.originalNetworkAddress.Length;
ctaipInfo.fFromDataSecurityProxy = authInfo.fromDataSecurityProxy;

ret = SNIAddProviderWrapper(pConn, providerEnum, ref ctaipInfo);

if (ret == ERROR_SUCCESS)
{
// added a provider, need to requery for sync over async support
ret = SNIGetInfoWrapper(pConn, QTypes.SNI_QUERY_CONN_SUPPORTS_SYNC_OVER_ASYNC, out bool _);
Debug.Assert(ret == ERROR_SUCCESS, "SNIGetInfo cannot fail with this QType");
}

return ret;
}

internal static void SNIPacketAllocate(SafeHandle pConn, IOType IOType, ref IntPtr pPacket)
{
pPacket = SNIPacketAllocateWrapper(pConn, IOType);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9433389

Please sign in to comment.