diff options
author | unknown <kostja@oak.local> | 2003-07-04 20:52:04 +0400 |
---|---|---|
committer | unknown <kostja@oak.local> | 2003-07-04 20:52:04 +0400 |
commit | ccbcf1c9da89eaee2dfb4219da1d86b6f590ac20 (patch) | |
tree | 8b19a2b1b84bfe2fb3f99f403acec7fb0a600501 /sql-common | |
parent | dbb088b034e19e99ec209cbbc4eed3bff64172da (diff) | |
download | mariadb-git-ccbcf1c9da89eaee2dfb4219da1d86b6f590ac20.tar.gz |
Bug fixes for authentication
OLD_PASSWORD made a keyword to allow set password=old_password('abc') constructions.
BitKeeper/etc/ignore:
Added BitKeeper/post-commit BitKeeper/post-commit-manual build_tags.sh tests/connect_test BUILD/compile-pentium-maintainer to the ignore list
include/mysql_com.h:
scramble return type changed to void as now it's not used
libmysql/libmysql.c:
fixed bug with with failed authentification when scramble contained zero byte
sql-common/client.c:
applied patch from Lycos team
fixed bug with scramble containing zero byte
sql/item_create.cc:
removed create_func_old_password, create_func_password as they are not used any more
sql/item_create.h:
removed create_func_old_password, create_func_password as they are not used any more
sql/item_strfunc.cc:
Added alloc() function to Item_func_password, Item_func_old_password, which is used in sql_yacc.yy
sql/item_strfunc.h:
Added alloc() function to Item_func_password, Item_func_old_password, which is used in sql_yacc.yy
sql/lex.h:
OLD_PASSWORD now is keyword, to allow statements like
set password=old_password('abc')
sql/password.c:
fixed scramble return value
trailing zero now is not written
sql/sql_acl.cc:
incorporated patch from Lycos team
41 replaced with constant
acl_getroot rewritten to support ER_AUTH_... error
sql/sql_parse.cc:
authenticate merged with check_user
check_user return values reversed, support for ER_AUTH in check_user.added
sql/sql_yacc.yy:
OLD_PASSWORD now is keyword, to allow statements like
set password=old_password('abc')
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 35dea62edc3..efb71021f8d 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1823,7 +1823,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, mysql->server_status, client_flag)); /* This needs to be changed as it's not useful with big packets */ if (user && user[0]) - strmake(end,user,32); /* Max user name */ + strmake(end,user,USERNAME_LENGTH); /* Max user name */ else read_user_name((char*) end); @@ -1835,21 +1835,25 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, end= strend(end) + 1; if (passwd[0]) { - /* Write NULL-terminated scrambled password: */ - end= mysql->server_capabilities & CLIENT_SECURE_CONNECTION ? - scramble(end, mysql->scramble, passwd) : - scramble_323(end, mysql->scramble_323, passwd, - (my_bool) (mysql->protocol_version == 9)); + if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + *end++= SCRAMBLE_LENGTH; + scramble(end, mysql->scramble, passwd); + end+= SCRAMBLE_LENGTH; + } + else + end= scramble_323(end, mysql->scramble_323, passwd, + (my_bool) (mysql->protocol_version == 9)) + 1; } else - *end= '\0'; /* empty password */ + *end++= '\0'; /* empty password */ /* Add database if needed */ if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB)) { - end=strmake(end+1,db,NAME_LEN); - mysql->db=my_strdup(db,MYF(MY_WME)); - db=0; + end= strmake(end, db, NAME_LEN) + 1; + mysql->db= my_strdup(db,MYF(MY_WME)); + db= 0; } /* Write authentication package */ if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net)) |