summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <kostja@oak.local>2003-07-04 20:52:04 +0400
committerunknown <kostja@oak.local>2003-07-04 20:52:04 +0400
commitccbcf1c9da89eaee2dfb4219da1d86b6f590ac20 (patch)
tree8b19a2b1b84bfe2fb3f99f403acec7fb0a600501 /sql/sql_acl.cc
parentdbb088b034e19e99ec209cbbc4eed3bff64172da (diff)
downloadmariadb-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/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index bbc6b74c3a9..f88799c2843 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -51,7 +51,7 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length,
return (byte*) entry->key;
}
-#define ACL_KEY_LENGTH (sizeof(long)+NAME_LEN+17)
+#define ACL_KEY_LENGTH (sizeof(long)+NAME_LEN+USERNAME_LENGTH+1)
static DYNAMIC_ARRAY acl_hosts,acl_users,acl_dbs;
static MEM_ROOT mem, memex;
@@ -208,7 +208,8 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
DBUG_PRINT("info",("user table fields: %d, password length: %d",
table->fields, table->field[2]->field_length));
- if (table->field[2]->field_length < 41 && !use_old_passwords)
+ if (table->field[2]->field_length < SCRAMBLED_PASSWORD_CHAR_LENGTH &&
+ !use_old_passwords)
{
sql_print_error("mysql.user table is not updated to new password format; "
"Disabling new password usage until "
@@ -516,6 +517,7 @@ static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b)
RETURN VALUE
0 success: thread data and mqh are updated
1 user not found or authentification failure
+ 2 user found, has long (4.1.1) salt, but passwd is in old (3.23) format.
-1 user found, has short (3.23) salt, but passwd is in new (4.1.1) format.
*/
@@ -564,6 +566,9 @@ acl_getroot(THD *thd, USER_RESOURCES *mqh,
else if (passwd_len == SCRAMBLE_LENGTH &&
user_i->salt_len == SCRAMBLE_LENGTH_323)
res= -1;
+ else if (passwd_len == SCRAMBLE_LENGTH_323 &&
+ user_i->salt_len == SCRAMBLE_LENGTH)
+ res= 2;
/* linear search complete: */
break;
}