Bug #35332 GetPassword() don't working (when PasswordAnswer is NULL)
Submitted: 17 Mar 2008 11:26 Modified: 16 May 2008 13:19
Reporter: Andrey Yusupov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.2.1 OS:Windows
Assigned to: CPU Architecture:Any
Tags: GetPassword

[17 Mar 2008 11:26] Andrey Yusupov
Description:
MySQLMembershipProvider

If PasswordAnswer is NULL GetPassword() don't working and generate exception.

How to repeat:
1) Set in provider: requiresQuestionAndAnswer="false"
2) Create user without Qyestion and Answer 
3) Execute User.GetPassword()

Suggested fix:
// exception when PasswordAnswer is NULL
// GetString don't work with DB NULL values
string passwordAnswer = reader.GetString("PasswordAnswer");

// work
string passwordAnswer = reader.GetValue(reader.GetOrdinal("PasswordAnswer")).ToString();
[26 Mar 2008 16:53] 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/44463
[26 Mar 2008 16:53] Reggie Burnett
Fixed in 5.2.2
[16 May 2008 13:19] MC Brown
A note has been added to the 5.2.2 changelog: 

An error would be raised when calling GetPassword() with a NULL value.