summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2014-12-02 10:59:44 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2014-12-02 10:59:44 +0100
commit3502d7412148d543082aad3c72bbadf742f0a60d (patch)
tree8564a7a40736a8732cfd42ad66b04c6d62d001d5 /sql/item_strfunc.h
parent53ff66fe31ee4e0fa646f646cee10095390471af (diff)
downloadmariadb-git-3502d7412148d543082aad3c72bbadf742f0a60d.tar.gz
MDEV-7015: SET STATEMENT old_passwords has no effectMDEV-7015
Decision about algorihtm moved on prepare phase. Made possible to add mpore password algorithms.
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h42
1 files changed, 17 insertions, 25 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 8377a20e0a4..b79009c6778 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -407,40 +407,32 @@ public:
class Item_func_password :public Item_str_ascii_func
{
+public:
+ enum PW_Alg {OLD, NEW};
+private:
char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
+ enum PW_Alg alg;
+ bool deflt;
public:
- Item_func_password(Item *a) :Item_str_ascii_func(a) {}
+ Item_func_password(Item *a) :Item_str_ascii_func(a), alg(NEW), deflt(1) {}
+ Item_func_password(Item *a, PW_Alg al) :Item_str_ascii_func(a),
+ alg(al), deflt(0) {}
String *val_str_ascii(String *str);
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{
- fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH, default_charset());
+ fix_length_and_charset((alg == 1 ?
+ SCRAMBLED_PASSWORD_CHAR_LENGTH :
+ SCRAMBLED_PASSWORD_CHAR_LENGTH_323),
+ default_charset());
}
- const char *func_name() const { return "password"; }
- static char *alloc(THD *thd, const char *password, size_t pass_len);
+ const char *func_name() const { return ((deflt || alg == 1) ?
+ "password" : "old_password"); }
+ static char *alloc(THD *thd, const char *password, size_t pass_len,
+ enum PW_Alg al);
};
-/*
- Item_func_old_password -- PASSWORD() implementation used in MySQL 3.21 - 4.0
- compatibility mode. This item is created in sql_yacc.yy when
- 'old_passwords' session variable is set, and to handle OLD_PASSWORD()
- function.
-*/
-
-class Item_func_old_password :public Item_str_ascii_func
-{
- char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1];
-public:
- Item_func_old_password(Item *a) :Item_str_ascii_func(a) {}
- String *val_str_ascii(String *str);
- void fix_length_and_dec()
- {
- fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH_323, default_charset());
- }
- const char *func_name() const { return "old_password"; }
- static char *alloc(THD *thd, const char *password, size_t pass_len);
-};
-
class Item_func_des_encrypt :public Item_str_func
{