From: Date: August 28 2008 10:21pm
Subject: Connector/NET commit: r1394 - in trunk: . MySql.Data/Provider MySql.Web/Providers/Source MySql.Web/Tests
List-Archive: http://lists.mysql.com/commits/52874
X-Bug: 38939
Message-Id: <200808282021.m7SKLZiB025018@bk-internal.mysql.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Modified:
trunk/CHANGES
trunk/MySql.Data/Provider/MySql.Data.csproj
trunk/MySql.Web/Providers/Source/MembershipProvider.cs
trunk/MySql.Web/Tests/UserManagement.cs
Log:
- fixed membership provider so that calling GetPassword with an incorrect password will
throw the appropriate exception (bug #38939)
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2008-08-27 15:20:11 UTC (rev 1393)
+++ trunk/CHANGES 2008-08-28 20:21:34 UTC (rev 1394)
@@ -7,7 +7,10 @@
different case then an exception would be thrown.
- Developed and integrated a new sql tokenizer. This tokenizer now recognizes all comment
types and is approx. 40% faster.
+- fixed membership provider so that calling GetPassword with an incorrect password will
+ throw the appropriate exception (bug #38939)
+
Version 5.2.3 - 8/14/08
- Increased the speed of MySqlDataReader.GetOrdinal dramatically by using a couple
of hashes for lookups
Modified: trunk/MySql.Data/Provider/MySql.Data.csproj
===================================================================
--- trunk/MySql.Data/Provider/MySql.Data.csproj 2008-08-27 15:20:11 UTC (rev 1393)
+++ trunk/MySql.Data/Provider/MySql.Data.csproj 2008-08-28 20:21:34 UTC (rev 1394)
@@ -218,6 +218,8 @@
True
Resources.resx
+
+
Modified: trunk/MySql.Web/Providers/Source/MembershipProvider.cs
===================================================================
--- trunk/MySql.Web/Providers/Source/MembershipProvider.cs 2008-08-27 15:20:11 UTC (rev 1393)
+++ trunk/MySql.Web/Providers/Source/MembershipProvider.cs 2008-08-28 20:21:34 UTC (rev 1394)
@@ -734,8 +734,8 @@
string password = reader.GetString("Password");
string passwordAnswer = reader.GetValue(reader.GetOrdinal("PasswordAnswer")).ToString();
string passwordKey = reader.GetString("PasswordKey");
- MembershipPasswordFormat format = (MembershipPasswordFormat)
- reader.GetInt32(3);
+ MembershipPasswordFormat format = (MembershipPasswordFormat)reader.GetInt32(3);
+ reader.Close();
if (RequiresQuestionAndAnswer &&
!(CheckPassword(answer, passwordAnswer, passwordKey, format)))
Modified: trunk/MySql.Web/Tests/UserManagement.cs
===================================================================
--- trunk/MySql.Web/Tests/UserManagement.cs 2008-08-27 15:20:11 UTC (rev 1393)
+++ trunk/MySql.Web/Tests/UserManagement.cs 2008-08-28 20:21:34 UTC (rev 1394)
@@ -417,7 +417,43 @@
GetPasswordHelper(true, true, "blue");
}
+ ///
+ /// Bug #38939 MembershipUser.GetPassword(string answer) fails when incorrect answer is passed.
+ ///
[Test]
+ public void GetPasswordWithWrongAnswer()
+ {
+ MembershipCreateStatus status;
+ provider = new MySQLMembershipProvider();
+ NameValueCollection config = new NameValueCollection();
+ config.Add("connectionStringName", "LocalMySqlServer");
+ config.Add("requiresQuestionAndAnswer", "true");
+ config.Add("enablePasswordRetrieval", "true");
+ config.Add("passwordFormat", "Encrypted");
+ config.Add("applicationName", "/");
+ provider.Initialize(null, config);
+ provider.CreateUser("foo", "barbar!", "foo@stripped", "color", "blue", true, null, out status);
+
+ MySQLMembershipProvider provider2 = new MySQLMembershipProvider();
+ NameValueCollection config2 = new NameValueCollection();
+ config2.Add("connectionStringName", "LocalMySqlServer");
+ config2.Add("requiresQuestionAndAnswer", "true");
+ config2.Add("enablePasswordRetrieval", "true");
+ config2.Add("passwordFormat", "Encrypted");
+ config2.Add("applicationName", "/");
+ provider2.Initialize(null, config2);
+
+ try
+ {
+ string pw = provider2.GetPassword("foo", "wrong");
+ Assert.Fail("Should have failed");
+ }
+ catch (MembershipPasswordException)
+ {
+ }
+ }
+
+ [Test]
public void GetUser()
{
MembershipCreateStatus status;