Bug #31433 Username incorrectly cached for logon where case sensitive

Submitted: 7 Oct 2007 14:13 Modified: 13 Nov 2007 11:40
Reporter: Nick dAlterio Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.0.37 OS:Windows
Assigned to: CPU Architecture:Any

[7 Oct 2007 14:13] Nick dAlterio
Description:
Using .NET connectors 5.0.7 and 5.0.8.1 I find that the logon credentials are incorrectly cached (by the server?) when there is a mistake in only case of user id. For example 

The correct user id = Test

Logon attempt 1 with User ID = test fails with the error

Access denied for user 'test'@'localhost' (using password: YES)

Logon attempt 1 with User ID = Test fails with the error

Access denied for user 'test'@'localhost' (using password: YES)

As you can see the user id appears to have been cached as the first incorrect version.

How to repeat:
The following code demonstrates the problem

using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;

namespace ConsoleApplication1
{
	class Program
	{
		static void Main( string[] args )
		{

			// Connect to the DB with wrong username - lowercase first char
			using ( MySqlConnection con = new MySqlConnection( "Database=test;Server=localhost;User Id=test;Password=test" ) )
			{
				try
				{
					con.Open();
				}   // try
				catch ( MySqlException dbe )
				{
					Console.WriteLine( dbe.Message );
				}   // catch
			}   // using

			// Connect to the DB with correct username
			using ( MySqlConnection con = new MySqlConnection( "Database=test;Server=localhost;User Id=Test;Password=test" ) )
			{
				try
				{

					// Connect to the DB
					con.Open();
				}   // try
				catch ( MySqlException dbe )
				{
					Console.WriteLine( dbe.Message );
				}   // catch

			}   // using

		}
	}
}

Suggested fix:
Perform case sensitive check when looking for cache hits
[11 Oct 2007 7:21] Tonci Grgin
Hi Nick and thanks for your report. This sure sounds like c/NET problem so I'll start from there.
[25 Oct 2007 19:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36373
[25 Oct 2007 19:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36374
[25 Oct 2007 19:41] Reggie Burnett
Fixed in 5.0.9 and 5.1.4+
[13 Nov 2007 11:40] MC Brown
A note has been added to the 5.0.9, 5.1.4 and 5.2.0 changelog: 

        Data cached from the connection string could return invalid
        information because the internal routines were not using
        case-sensitive semantics. This lead to updated connection string
        options not being recognized if they were of a different case
        than the existing cached values.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.