Skip to content

Commit 245db93

Browse files
Address TSA Scan issues (#586)
1 parent c6fa6bd commit 245db93

File tree

15 files changed

+34
-34
lines changed

15 files changed

+34
-34
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ internal void PutObject(DbConnectionInternal obj, object owningObject)
15571557
// once we leave the lock, because it sets _pooledCount such
15581558
// that it won't appear to be out of the pool. What that
15591559
// means, is that we're now responsible for this connection:
1560-
// it won't get reclaimed if we drop the ball somewhere.
1560+
// it won't get reclaimed if it gets lost.
15611561
obj.PrePush(owningObject);
15621562
}
15631563

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G
332332
ValidateValueLength(_dataSource, TdsEnums.MAXLEN_SERVERNAME, KEY.Data_Source);
333333
ValidateValueLength(_failoverPartner, TdsEnums.MAXLEN_SERVERNAME, KEY.FailoverPartner);
334334
ValidateValueLength(_initialCatalog, TdsEnums.MAXLEN_DATABASE, KEY.Initial_Catalog);
335-
ValidateValueLength(_password, TdsEnums.MAXLEN_PASSWORD, KEY.Password);
336-
ValidateValueLength(_userID, TdsEnums.MAXLEN_USERNAME, KEY.User_ID);
335+
ValidateValueLength(_password, TdsEnums.MAXLEN_CLIENTSECRET, KEY.Password);
336+
ValidateValueLength(_userID, TdsEnums.MAXLEN_CLIENTID, KEY.User_ID);
337337
if (null != _workstationId)
338338
{
339339
ValidateValueLength(_workstationId, TdsEnums.MAXLEN_HOSTNAME, KEY.Workstation_Id);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ public SqlCredential(string userId, SecureString password)
2121
throw ADP.ArgumentNull(nameof(userId));
2222
}
2323

24-
if (userId.Length > TdsEnums.MAXLEN_USERNAME)
24+
if (userId.Length > TdsEnums.MAXLEN_CLIENTID)
2525
{
26-
throw ADP.InvalidArgumentLength(nameof(userId), TdsEnums.MAXLEN_USERNAME);
26+
throw ADP.InvalidArgumentLength(nameof(userId), TdsEnums.MAXLEN_CLIENTID);
2727
}
2828

2929
if (password == null)
3030
{
3131
throw ADP.ArgumentNull(nameof(password));
3232
}
3333

34-
if (password.Length > TdsEnums.MAXLEN_PASSWORD)
34+
if (password.Length > TdsEnums.MAXLEN_CLIENTSECRET)
3535
{
36-
throw ADP.InvalidArgumentLength(nameof(password), TdsEnums.MAXLEN_PASSWORD);
36+
throw ADP.InvalidArgumentLength(nameof(password), TdsEnums.MAXLEN_CLIENTSECRET);
3737
}
3838

3939
if (!password.IsReadOnly())

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,8 @@ public enum ActiveDirectoryWorkflow : byte
603603
// Login data validation Rules
604604
//
605605
internal const ushort MAXLEN_HOSTNAME = 128; // the client machine name
606-
internal const ushort MAXLEN_USERNAME = 128; // the client user id
607-
internal const ushort MAXLEN_PASSWORD = 128; // the password supplied by the client
606+
internal const ushort MAXLEN_CLIENTID = 128;
607+
internal const ushort MAXLEN_CLIENTSECRET = 128;
608608
internal const ushort MAXLEN_APPNAME = 128; // the client application name
609609
internal const ushort MAXLEN_SERVERNAME = 128; // the server name
610610
internal const ushort MAXLEN_CLIENTINTERFACE = 128; // the interface library name

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,7 @@ internal bool TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataRead
24442444
// we throw an Operation Cancelled error
24452445
if (stateObj.HasReceivedAttention)
24462446
{
2447-
// Dev11 #344723: SqlClient stress hang System_Data!Tcp::ReadSync via a call to SqlDataReader::Close
2447+
// Dev11 #344723: SqlClient stress test suspends System_Data!Tcp::ReadSync via a call to SqlDataReader::Close
24482448
// Spin until SendAttention has cleared _attentionSending, this prevents a race condition between receiving the attention ACK and setting _attentionSent
24492449
TryRunSetupSpinWaitContinuation(stateObj);
24502450

@@ -7798,11 +7798,11 @@ internal void TdsLogin(SqlLogin rec, TdsEnums.FeatureExtension requestedFeatures
77987798
Debug.Assert(fedAuthFeatureExtensionData == null || (requestedFeatures & TdsEnums.FeatureExtension.FedAuth) != 0, "fedAuthFeatureExtensionData provided without fed auth feature request");
77997799
Debug.Assert(fedAuthFeatureExtensionData != null || (requestedFeatures & TdsEnums.FeatureExtension.FedAuth) == 0, "Fed Auth feature requested without specifying fedAuthFeatureExtensionData.");
78007800

7801-
Debug.Assert(rec.userName == null || (rec.userName != null && TdsEnums.MAXLEN_USERNAME >= rec.userName.Length), "_userID.Length exceeds the max length for this value");
7802-
Debug.Assert(rec.credential == null || (rec.credential != null && TdsEnums.MAXLEN_USERNAME >= rec.credential.UserId.Length), "_credential.UserId.Length exceeds the max length for this value");
7801+
Debug.Assert(rec.userName == null || (rec.userName != null && TdsEnums.MAXLEN_CLIENTID >= rec.userName.Length), "_userID.Length exceeds the max length for this value");
7802+
Debug.Assert(rec.credential == null || (rec.credential != null && TdsEnums.MAXLEN_CLIENTID >= rec.credential.UserId.Length), "_credential.UserId.Length exceeds the max length for this value");
78037803

7804-
Debug.Assert(rec.password == null || (rec.password != null && TdsEnums.MAXLEN_PASSWORD >= rec.password.Length), "_password.Length exceeds the max length for this value");
7805-
Debug.Assert(rec.credential == null || (rec.credential != null && TdsEnums.MAXLEN_PASSWORD >= rec.credential.Password.Length), "_credential.Password.Length exceeds the max length for this value");
7804+
Debug.Assert(rec.password == null || (rec.password != null && TdsEnums.MAXLEN_CLIENTSECRET >= rec.password.Length), "_password.Length exceeds the max length for this value");
7805+
Debug.Assert(rec.credential == null || (rec.credential != null && TdsEnums.MAXLEN_CLIENTSECRET >= rec.credential.Password.Length), "_credential.Password.Length exceeds the max length for this value");
78067806

78077807
Debug.Assert(rec.credential != null || rec.userName != null || rec.password != null, "cannot mix the new secure password system and the connection string based password");
78087808
Debug.Assert(rec.newSecurePassword != null || rec.newPassword != null, "cannot have both new secure change password and string based change password");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3465,7 +3465,7 @@ internal void SendAttention(bool mustTakeWriteLock = false)
34653465

34663466
try
34673467
{
3468-
// Dev11 #344723: SqlClient stress hang System_Data!Tcp::ReadSync via a call to SqlDataReader::Close
3468+
// Dev11 #344723: SqlClient stress test suspends System_Data!Tcp::ReadSync via a call to SqlDataReader::Close
34693469
// Set _attentionSending to true before sending attention and reset after setting _attentionSent
34703470
// This prevents a race condition between receiving the attention ACK and setting _attentionSent
34713471
_attentionSending = true;

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ internal void PutObject(DbConnectionInternal obj, object owningObject)
18201820
// once we leave the lock, because it sets _pooledCount such
18211821
// that it won't appear to be out of the pool. What that
18221822
// means, is that we're now responsible for this connection:
1823-
// it won't get reclaimed if we drop the ball somewhere.
1823+
// it won't get reclaimed if it gets lost.
18241824
obj.PrePush(owningObject);
18251825

18261826
// TODO: Consider using a Cer to ensure that we mark the object for reclaimation in the event something bad happens?

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G
415415
ValidateValueLength(_dataSource, TdsEnums.MAXLEN_SERVERNAME, KEY.Data_Source);
416416
ValidateValueLength(_failoverPartner, TdsEnums.MAXLEN_SERVERNAME, KEY.FailoverPartner);
417417
ValidateValueLength(_initialCatalog, TdsEnums.MAXLEN_DATABASE, KEY.Initial_Catalog);
418-
ValidateValueLength(_password, TdsEnums.MAXLEN_PASSWORD, KEY.Password);
419-
ValidateValueLength(_userID, TdsEnums.MAXLEN_USERNAME, KEY.User_ID);
418+
ValidateValueLength(_password, TdsEnums.MAXLEN_CLIENTSECRET, KEY.Password);
419+
ValidateValueLength(_userID, TdsEnums.MAXLEN_CLIENTID, KEY.User_ID);
420420
if (null != _workstationId)
421421
{
422422
ValidateValueLength(_workstationId, TdsEnums.MAXLEN_HOSTNAME, KEY.Workstation_Id);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ public SqlCredential(string userId, SecureString password)
2828
throw ADP.ArgumentNull("userId");
2929
}
3030

31-
if (userId.Length > TdsEnums.MAXLEN_USERNAME)
31+
if (userId.Length > TdsEnums.MAXLEN_CLIENTID)
3232
{
33-
throw ADP.InvalidArgumentLength("userId", TdsEnums.MAXLEN_USERNAME);
33+
throw ADP.InvalidArgumentLength("userId", TdsEnums.MAXLEN_CLIENTID);
3434
}
3535

3636
if (password == null)
3737
{
3838
throw ADP.ArgumentNull("password");
3939
}
4040

41-
if (password.Length > TdsEnums.MAXLEN_PASSWORD)
41+
if (password.Length > TdsEnums.MAXLEN_CLIENTSECRET)
4242
{
43-
throw ADP.InvalidArgumentLength("password", TdsEnums.MAXLEN_PASSWORD);
43+
throw ADP.InvalidArgumentLength("password", TdsEnums.MAXLEN_CLIENTSECRET);
4444
}
4545

4646
if (!password.IsReadOnly())

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3412,7 +3412,7 @@ private bool TryHasMoreResults(out bool moreResults)
34123412
return true;
34133413
}
34143414

3415-
// Dev11 Bug 316483:Hang on SqlDataReader::TryHasMoreResults using MARS
3415+
// Dev11 Bug 316483: Stuck at SqlDataReader::TryHasMoreResults using MARS
34163416
// http://vstfdevdiv:8080/web/wi.aspx?pcguid=22f9acc9-569a-41ff-b6ac-fac1b6370209&id=316483
34173417
// TryRun() will immediately return if the TdsParser is closed\broken, causing us to enter an infinite loop
34183418
// Instead, we will throw a closed connection exception
@@ -3497,7 +3497,7 @@ private bool TryHasMoreRows(out bool moreRows)
34973497
ParsedDoneToken = true;
34983498
}
34993499

3500-
// Dev11 Bug 316483:Hang on SqlDataReader::TryHasMoreResults using MARS
3500+
// Dev11 Bug 316483: Stuck at SqlDataReader::TryHasMoreResults when using MARS
35013501
// http://vstfdevdiv:8080/web/wi.aspx?pcguid=22f9acc9-569a-41ff-b6ac-fac1b6370209&id=316483
35023502
// TryRun() will immediately return if the TdsParser is closed\broken, causing us to enter an infinite loop
35033503
// Instead, we will throw a closed connection exception

0 commit comments

Comments
 (0)