diff options
author | unknown <kostja@oak.local> | 2003-07-01 23:40:59 +0400 |
---|---|---|
committer | unknown <kostja@oak.local> | 2003-07-01 23:40:59 +0400 |
commit | dbb088b034e19e99ec209cbbc4eed3bff64172da (patch) | |
tree | cbcae0aeb3eee5a5a448084ae5f0e9b5290fac26 /sql/sql_yacc.yy | |
parent | b871e549eeec215bd40554431de8d21942e596d6 (diff) | |
download | mariadb-git-dbb088b034e19e99ec209cbbc4eed3bff64172da.tar.gz |
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
For now following tasks have been done:
- PASSWORD() function was rewritten. PASSWORD() now returns SHA1
hash_stage2; for new passwords user.password contains '*'hash_stage2; sql_yacc.yy also fixed;
- password.c: new functions were implemented, old rolled back to 4.0 state
- server code was rewritten to use new authorization algorithm (check_user(), change
user, and other stuff in sql/sql_parse.cc)
- client code was rewritten to use new authorization algorithm
(mysql_real_connect, myslq_authenticate in sql-common/client.c)
- now server barks on 45-byte-length 4.1.0 passwords and refuses 4.1.0-style
authentification. Users with 4.1.0 passwords are blocked (sql/sql_acl.cc)
- mysqladmin.c was fixed to work correctly with new passwords
Tests for 4.0-4.1.1, 4.1.1-4.1.1 (with or without db/password) logons was performed;
mysqladmin also was tested. Additional check are nevertheless necessary.
BitKeeper/etc/ignore:
Added start_mysqld.sh mysys/main.cc to the ignore list
client/mysqladmin.c:
fixed with new password api
include/mysql.h:
So as scramble_323 accepts only null-terminated message, two scramble buffs are necessary.
gotta be fixed
include/mysql_com.h:
new constants and password.c api changes
libmysql/libmysql.c:
mysql_change_user rewritten to work with new password api
scripts/mysql_create_system_tables.sh:
fixed 'Password' column length to 41
scripts/mysql_fix_privilege_tables.sql:
fixed 'Password' column length to 41
sql-common/client.c:
mysql_real_connect rewritten to support new handshake procedure
sql/item_strfunc.cc:
Item_func_password and Item_func_old_password rewritten with new password api
sql/item_strfunc.h:
bit commented, numbers replaced with #defined constants
sql/mysql_priv.h:
removed unnecessary declaration as now all constants defined is in mysql_com.h
sql/mysqld.cc:
scramble initialization moved to sql_parce.cc:check_connection
sql/password.c:
All 4.1 functions were rolled back to 4.0 with attempt to save all possible 4.0-4.1 changes.
Names for 4.0 functions were suffixed with '_323'
Functions for new handshake were added.
sql/slave.cc:
Fixed to new constant; Bug #766 remains to be fixed
sql/slave.h:
fixed to new constant; Buf #766 remains to be fixed
sql/sql_acl.cc:
rewritten to support new passwords (41 byte-long) and password api
sql/sql_acl.h:
ditto
sql/sql_class.cc:
initialization for new members added
sql/sql_class.h:
same thing as in struct mysql - scramble is used for new family of functions, scramble_323 - for old
sql/sql_parse.cc:
check_connections was renamed to check_connection as this name reflects better what this function does
authorization part of check_connection was rewritten
check_user was rewritten with new password and acl api
new function 'authenticate', which optionally re-request scramble from client was added
fixed some typos
COM_CHANGE_USER piece of dipsatch_command() was rewritten
sql/sql_repl.h:
HASH_PASSWORD_LENGTH replaced with SCRAMBLED_PASSWORD_CHAR_LENGTH
bug #766 remains
sql/sql_yacc.yy:
Two-argument form of PASSWORD() was removed
PASSWORD() function was fixed with new password api.
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1d605abe8a3..c8c9eb97a6a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2515,9 +2515,10 @@ simple_expr: | NOW_SYM '(' expr ')' { $$= new Item_func_now($3); Lex->safe_to_cache_query=0;} | PASSWORD '(' expr ')' - { $$= new Item_func_password($3); } - | PASSWORD '(' expr ',' expr ')' - { $$= new Item_func_password($3,$5); } + { + $$= use_old_passwords ? (Item *) new Item_func_old_password($3) : + (Item *) new Item_func_password($3); + } | POINT_SYM '(' expr ',' expr ')' { $$= new Item_func_point($3,$5); } | POINTFROMTEXT '(' expr ')' @@ -4604,13 +4605,22 @@ text_or_password: { if (!$3.length) $$=$3.str; - else + else if (use_old_passwords) { - char *buff=(char*) YYTHD->alloc(HASH_PASSWORD_LENGTH+1); - make_scrambled_password(buff,$3.str,use_old_passwords, - &YYTHD->rand); + char *buff= (char *) + YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); + if (buff) + make_scrambled_password_323(buff, $3.str); $$=buff; } + else + { + char *buff= (char *) + YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); + if (buff) + make_scrambled_password(buff, $3.str); + $$=buff; + } } ; @@ -4918,14 +4928,24 @@ grant_user: $$=$1; $1->password=$4; if ($4.length) { - char *buff=(char*) YYTHD->alloc(HASH_PASSWORD_LENGTH+1); - if (buff) - { - make_scrambled_password(buff,$4.str,use_old_passwords, - &YYTHD->rand); - $1->password.str=buff; - $1->password.length=HASH_PASSWORD_LENGTH; - } + if (use_old_passwords) + { + char *buff= + (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); + if (buff) + make_scrambled_password_323(buff, $4.str); + $1->password.str= buff; + $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323; + } + else + { + char *buff= + (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); + if (buff) + make_scrambled_password(buff, $4.str); + $1->password.str= buff; + $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH; + } } } | user IDENTIFIED_SYM BY PASSWORD TEXT_STRING |