Commit 42de9a3e authored by unknown's avatar unknown

Fix for bug #1271: Undefined variable in PASSWORD() function is not

handled correctly

parent 14affe7e
......@@ -7,3 +7,13 @@ old_password('test') password('test')
select length(encrypt('test')), encrypt('test','aa');
length(encrypt('test')) encrypt('test','aa')
13 aaqPiZY5xR5l.
drop table if exists t1;
create table t1 (name varchar(50), pw varchar(16));
insert into t1 values ('tom', password('my_pass'));
set @pass='my_pass';
select name from t1 where name='tom' and pw=password(@pass);
name
tom
select name from t1 where name='tom' and pw=password(@undefined);
name
drop table t1;
......@@ -4,3 +4,12 @@ select length(encrypt('foo', 'ff')) <> 0;
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
select old_password('test'), password('test');
select length(encrypt('test')), encrypt('test','aa');
drop table if exists t1;
create table t1 (name varchar(50), pw varchar(16));
insert into t1 values ('tom', password('my_pass'));
set @pass='my_pass';
select name from t1 where name='tom' and pw=password(@pass);
select name from t1 where name='tom' and pw=password(@undefined);
drop table t1;
......@@ -2087,7 +2087,7 @@ void Item_func_get_user_var::fix_length_and_dec()
bool Item_func_get_user_var::const_item() const
{
return var_entry && current_thd->query_id != var_entry->update_query_id;
return (!var_entry || current_thd->query_id != var_entry->update_query_id);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment