SCM

[#1011380] false parameter value is passed as true

View Trackers | Bugs | Download .csv | Monitor

Date:
2013-10-17 10:42
Priority:
3
State:
Closed
Submitted by:
Andrus Moor (kobruleht)
Assigned to:
Nobody (None)
Npgsql Version:
2.0.13-beta1
Category:
None
Group:
None
Resolution:
Accepted
Summary:
false parameter value is passed as true

Detailed description
Using git master and NauckIt membershipprovider, false parameter value is passed as true server.

Tried NauckIT PgMembershipProvicer.cs modified ResetPassword method:

using (NpgsqlCommand dbUpdateCommand = dbConn.CreateCommand())
{
dbUpdateCommand.CommandText = string.Format(CultureInfo.InvariantCulture, "UPDATE kasutaja SET Passwordha = @Password, LastPasswordChangedDate = @LastPasswordChangedDate WHERE kasutaja = trim(upper(@Username)) and islocked = @IsLockedOut");

dbUpdateCommand.Parameters.Add("@Password", NpgsqlDbType.Varchar, 128).Value = EncodePassword(newPassword);
dbUpdateCommand.Parameters.Add("@LastPasswordChangedDate", NpgsqlDbType.TimestampTZ).Value = DateTime.Now;
dbUpdateCommand.Parameters.Add("@Username", NpgsqlDbType.Varchar, 255).Value = username;

// actually true is passed to server:
dbUpdateCommand.Parameters.Add("@IsLockedOut", NpgsqlDbType.Boolean).Value = false;
dbUpdateCommand.Prepare();
rowsAffected = dbUpdateCommand.ExecuteNonQuery();

output in server log:


LOG: execute npgsqlplan2: UPDATE kasutaja SET Passwordha = $1::varchar(128), LastPasswordChangedDate = $2::timestamptz WHERE kasutaja = trim(upper($3::varchar(255))) and islocked = $4::bool
2013-10-17 12:23:09 EEST DETAIL: parameters: $1 = 'ya6PS3VfXHL2VT3/8H6eC7JJ9ZU=', $2 = '2013-10-17 12:23:07.042988+03', $3 = 'ADMIN', $4 = 't'


note that $4 value is passed as true mut in code it is passed as false.


islocked is defined as ebool:

CREATE TABLE kasutaja( ... islocked ebool )

ebool is defined as

CREATE DOMAIN ebool AS boolean DEFAULT false NOT NULL;


How to fix ?

Followup

Message
Date: 2013-11-19 17:26
Sender: Francisco Figueiredo jr.


Fixed in git: https://github.com/npgsql/Npgsql/commit/900ed0afc24f4f6d91edb3f230e3c05e220fe239

Thanks for heads up, Andrus!

Attached Files:

Changes:

Field Old Value Date By
ResolutionNone2013-11-19 17:26fxjr
status_idOpen2013-11-19 17:26fxjr
close_dateNone2013-11-19 17:26fxjr
Powered By FusionForge