Skip to content

Commit c6c95c2

Browse files
committed
naming consistency and other feedback
1 parent 13ab3b4 commit c6c95c2

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ internal override void CreatePhysicalSNIHandle(
9494
string hostNameInCertificate,
9595
string serverCertificateFilename)
9696
{
97-
SNIHandle? sessionHandle = SNIProxy.CreateConnectionHandle(serverName, timeout, out instanceName, ref spn, serverSPN,
97+
SNIHandle? sessionHandle = SNIProxy.CreateConnectionHandle(serverName, timeout, out instanceName, ref spns, serverSPN,
9898
flushCache, async, parallel, isIntegratedSecurity, iPAddressPreference, cachedFQDN, ref pendingDNSInfo, tlsFirst,
9999
hostNameInCertificate, serverCertificateFilename);
100100

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ internal override void CreatePhysicalSNIHandle(
178178

179179
_sessionHandle = new SNIHandle(myInfo, serverName, ref serverSPN, timeout.MillisecondsRemainingInt, out instanceName,
180180
flushCache, !async, fParallel, ipPreference, cachedDNSInfo, hostNameInCertificate);
181-
spn = new[] { serverSPN.TrimEnd() };
181+
spns = new[] { serverSPN.TrimEnd() };
182182
}
183183

184184
protected override uint SNIPacketGetData(PacketHandle packet, byte[] _inBuff, ref uint dataSize)

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/BufferWriterExtensions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Buffers;
1+
using System;
2+
using System.Buffers;
23
using System.Text;
34

45
namespace Microsoft.Data.SqlClient
@@ -12,9 +13,9 @@ internal static long GetBytes(this Encoding encoding, string str, IBufferWriter<
1213

1314
try
1415
{
15-
encoding.GetBytes(str, 0, str.Length, array, 0);
16-
bufferWriter.Write(array);
17-
return count;
16+
var length = encoding.GetBytes(str, 0, str.Length, array, 0);
17+
bufferWriter.Write(array.AsSpan(0, length));
18+
return length;
1819
}
1920
finally
2021
{

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/NativeSSPIContextProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected override void GenerateSspiClientContext(ReadOnlySpan<byte> incomingBlo
6262
var sendLength = s_maxSSPILength;
6363
var outBuff = outgoingBlobWriter.GetSpan((int)sendLength);
6464

65-
if (0 != SniNativeWrapper.SNISecGenClientContext(handle, incomingBlob, outBuff, ref sendLength, serverSpn[0]))
65+
if (0 != SniNativeWrapper.SNISecGenClientContext(handle, incomingBlob, outBuff, ref sendLength, serverSpns[0]))
6666
{
6767
throw new InvalidOperationException(SQLMessage.SSPIGenerateError());
6868
}

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/NegotiateSSPIContextProvider.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#if NET
22

33
using System;
4-
using System.Text;
54
using System.Net.Security;
65
using System.Buffers;
76

@@ -12,14 +11,14 @@ namespace Microsoft.Data.SqlClient
1211
internal sealed class NegotiateSSPIContextProvider : SSPIContextProvider
1312
{
1413
private NegotiateAuthentication? _negotiateAuth = null;
15-
16-
protected override void GenerateSspiClientContext(ReadOnlySpan<byte> incomingBlob, IBufferWriter<byte> outgoingBlobWriter, ReadOnlySpan<string> serverNames)
14+
15+
protected override void GenerateSspiClientContext(ReadOnlySpan<byte> incomingBlob, IBufferWriter<byte> outgoingBlobWriter, ReadOnlySpan<string> serverSpns)
1716
{
1817
NegotiateAuthenticationStatusCode statusCode = NegotiateAuthenticationStatusCode.UnknownCredentials;
1918

20-
for (int i = 0; i < serverNames.Length; i++)
19+
for (int i = 0; i < serverSpns.Length; i++)
2120
{
22-
_negotiateAuth ??= new(new NegotiateAuthenticationClientOptions { Package = "Negotiate", TargetName = serverNames[i] });
21+
_negotiateAuth ??= new(new NegotiateAuthenticationClientOptions { Package = "Negotiate", TargetName = serverSpns[i] });
2322
var sendBuff = _negotiateAuth.GetOutgoingBlob(incomingBlob, out statusCode)!;
2423

2524
// Log session id, status code and the actual SPN used in the negotiation

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/SSPIContextProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal void SSPIData(ReadOnlySpan<byte> receivedBuff, IBufferWriter<byte> outg
3737
{
3838
try
3939
{
40-
GenerateSspiClientContext(receivedBuff, outgoingBlobWriter, serverSpn);
40+
GenerateSspiClientContext(receivedBuff, outgoingBlobWriter, serverSpns);
4141
}
4242
catch (Exception e)
4343
{

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlObjectPool.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6-
using System.Buffers;
76
using System.Diagnostics;
8-
using System.Text;
97
using System.Threading;
108

119
namespace Microsoft.Data.SqlClient

0 commit comments

Comments
 (0)