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

Feature | Adding TDS 8 support #1608

Merged
merged 46 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c53a868
Adding TDS8 support to netcore
Apr 27, 2022
5ac2096
Merge branch 'dotnet:main' into TDS8-netcore
May 9, 2022
cf5aabf
Doc changes for TDS 8 (#2)
David-Engel May 9, 2022
f03963e
Review comments
May 11, 2022
e58fc33
Apply suggestions from code review
May 11, 2022
5ca4234
Review comments
May 11, 2022
50245ab
Merge branch 'TDS8-netcore' of https://github.com/JRahnama/SqlClient …
May 11, 2022
2bc897a
Address PR concerns
David-Engel May 15, 2022
2bf6882
Formatting
David-Engel May 15, 2022
b1eebcc
TDS 8 negotiation fixes
David-Engel May 15, 2022
684eb8a
Add HostNameInCertificate alias to doc
David-Engel May 15, 2022
64c8a31
Add TD8 new params in the SqlConnecitonBuilder tests
lcheunglci May 9, 2022
3f68f4d
Add the TDS8 param in the connection string tests
lcheunglci May 10, 2022
22d0c3b
Add tests for checking Encrypt keyword behaviour
lcheunglci May 10, 2022
86873f1
Revise ConnectionString_OtherKeyword test for HostNameInCertificate
lcheunglci May 10, 2022
fc5b493
Add backward compatibility encrypt value support tests
lcheunglci May 10, 2022
d29ae14
Connection string fixes and functional test adjustments
David-Engel May 15, 2022
85f0a3d
Remove invalid test
David-Engel May 15, 2022
3bcd6c0
Minor fix
David-Engel May 16, 2022
638a5f5
Restore code block removed by mistake
David-Engel May 16, 2022
94b5cfd
removing server name indication
May 17, 2022
07a05b6
Try implicit conversions to retain backwards compatibility
David-Engel May 18, 2022
d324768
Fix
David-Engel May 18, 2022
8e1662f
Fix Encrypt handling in the connection string
David-Engel May 18, 2022
110a5ee
Fix issues around Encrypt backwards compatibility
David-Engel May 19, 2022
ba0587d
Minor doc fix
David-Engel May 20, 2022
d0536b0
Optimize SqlConnectionEncryptOption to avoid excess object creation
David-Engel May 20, 2022
7cfcad7
Merge branch 'main' of https://github.com/dotnet/SqlClient into local…
David-Engel May 20, 2022
d53f9cf
Merge branch 'main' of https://github.com/dotnet/SqlClient into local…
David-Engel May 20, 2022
e079720
Merge branch 'TDS8-netcore' of https://github.com/JRahnama/SqlClient …
May 30, 2022
3a480a4
Fix ref bug
David-Engel Jun 2, 2022
4b70852
Apply suggestions from code review
David-Engel Jun 2, 2022
328aa44
Doc fix
David-Engel Jun 2, 2022
6e182e6
Minor edit
David-Engel Jun 2, 2022
633adea
related changes to make TDS8 supported in Native code
Jun 8, 2022
65b9117
fixing hostName in certificate
Jun 8, 2022
1811e52
Plumb TDS 8 support through netcore + native SNI
David-Engel Jun 9, 2022
a8e8cd1
Merge branch 'main' into TDS8-netcore
David-Engel Jun 9, 2022
8b01069
Remove unused parameter
David-Engel Jun 9, 2022
3fac489
Revert
David-Engel Jun 9, 2022
59ead11
Remove extra trace event from merge
David-Engel Jun 9, 2022
f38d141
Merge branch 'main' of https://github.com/dotnet/SqlClient into TDS8-…
David-Engel Jun 9, 2022
c46e7e3
Update to latest SNI package
David-Engel Jun 15, 2022
e536e0b
Merge branch 'main' of https://github.com/dotnet/SqlClient into TDS8-…
David-Engel Jun 15, 2022
7eb2140
Remove empty line
David-Engel Jun 15, 2022
4a03e52
Update SNI version in nuspec
David-Engel Jun 15, 2022
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 @@ -170,14 +170,18 @@ internal struct ConsumerInfo
internal IntPtr key;
}


[StructLayout(LayoutKind.Sequential)]
internal struct AuthProviderInfo
{
internal uint flags;
internal string certId;
internal bool certHash;
internal object clientCertificateCallbackContext;
internal SqlClientCertificateDelegate clientCertificateCallback;
public uint flags;
[MarshalAs(UnmanagedType.Bool)]
public bool tlsFirst;
[MarshalAs(UnmanagedType.LPWStr)]
public string certId;
[MarshalAs(UnmanagedType.Bool)]
public bool certHash;
public object clientCertificateCallbackContext;
public SqlClientCertificateDelegate clientCertificateCallback;
};

internal struct CTAIPProviderInfo
Expand Down Expand Up @@ -810,10 +814,7 @@ internal static unsafe uint SNIOpenSyncEx(
Boolean isAzureSqlServerEndpoint,
SqlConnectionIPAddressPreference ipPreference,
SQLDNSInfo cachedDNSInfo,
bool tlsFirst,
string hostNameInCertificate,
string databaseName,
ApplicationIntent applicationIntent)
string hostNameInCertificate)
{
//TDS 8 TODO: Plumb new options into native SNI call

Expand Down Expand Up @@ -891,7 +892,6 @@ internal static uint SNIAddProvider(SNIHandle pConn,
authInfo.clientCertificateCallbackContext = sniAuthInfoWrapper;
authInfo.clientCertificateCallback = SNIClientCertificateFallbackWrapper;
}

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

if (ret == ERROR_SUCCESS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ private void EnableSsl(uint info, bool encrypt, bool integratedSecurity, ServerC
authInfo.clientCertificateCallback = _clientCertificateCallback;
}
}

authInfo.tlsFirst = encrypt == SqlConnectionEncryptOption.Strict;
error = SNINativeMethodWrapper.SNIAddProvider(_physicalStateObj.Handle, SNINativeMethodWrapper.ProviderEnum.SSL_PROV, authInfo);

if (error != TdsEnums.SNI_SUCCESS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ internal SNIHandle(
SqlConnectionIPAddressPreference ipPreference,
SQLDNSInfo cachedDNSInfo,
bool tlsFirst,
string hostNameInCertificate,
string databaseName,
ApplicationIntent applicationIntent)
string hostNameInCertificate)
: base(IntPtr.Zero, true)
{

Expand All @@ -176,7 +174,7 @@ internal SNIHandle(
int transparentNetworkResolutionStateNo = (int)transparentNetworkResolutionState;
_status = SNINativeMethodWrapper.SNIOpenSyncEx(myInfo, serverName, ref base.handle,
spnBuffer, instanceName, flushCache, fSync, timeout, fParallel, transparentNetworkResolutionStateNo, totalTimeout,
ADP.IsAzureSqlServerEndpoint(serverName), ipPreference, cachedDNSInfo, tlsFirst, hostNameInCertificate, databaseName, applicationIntent);
ADP.IsAzureSqlServerEndpoint(serverName), ipPreference, cachedDNSInfo, hostNameInCertificate);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ internal void CreatePhysicalSNIHandle(

_sessionHandle = new SNIHandle(myInfo, serverName, spnBuffer, ignoreSniOpenTimeout, checked((int)timeout),
out instanceName, flushCache, !async, fParallel, transparentNetworkResolutionState, totalTimeout,
ipPreference, cachedDNSInfo, tlsFirst, hostNameInCertificate, databaseName, applicationIntent);
ipPreference, cachedDNSInfo, tlsFirst, hostNameInCertificate);
}

internal bool Deactivate()
Expand Down