diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 81a24e89164..377f714bfff 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -265,4 +265,5 @@ #define ER_DERIVED_MUST_HAVE_ALIAS 1246 #define ER_SELECT_REDUCED 1247 #define ER_TABLENAME_NOT_ALLOWED_HERE 1248 -#define ER_ERROR_MESSAGES 249 +#define ER_NOT_SUPPORTED_AUTH_MODE 1249 +#define ER_ERROR_MESSAGES 250 diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index c1ee8b12e7f..6c3196bfeba 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -259,3 +259,4 @@ v/* "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 17c1dd76474..dcc016511dd 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -253,3 +253,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index a2ef2b0923d..6091616fc4a 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -261,3 +261,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index eabbb6c1eeb..d235f8f49a5 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias", "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 367bda922f3..43eb5de89a5 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -255,3 +255,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 93009f564e6..d7bb19c2876 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 24ee7a99409..765fbd875e2 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -260,3 +260,4 @@ "FЭr jede abgeleitete Tabelle muss ein eigener Alias angegeben werden.", "Select %u wurde wДhrend der Optimierung reduziert.", "Tabelle '%-.64s', die in einem der SELECT-Befehle verwendet wurde kann nicht in %-.32s verwendet werden." +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index ffed9111859..8831d4e47b9 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index a597e3870b5..8d6c321d316 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 84b4d02dc9e..56b3018e3a6 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index f339faf5fc4..70ab2d6d42d 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 855f157d3b5..c18c3ed3873 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index d930ec5ab74..9cd99613f52 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 15bc59c39dc..32fe6c30b34 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 95315516cda..4b59a62f991 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -254,3 +254,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 47dc0ed569d..7236bd86652 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 722efe4f83f..0b8bbe1c219 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -254,3 +254,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index ddbb5bdbe5d..2f1eedd207c 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -253,3 +253,4 @@ "Every derived table must have it's own alias" "Select %u был упразднен в процессе оптимизации", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index c9ab4d8f656..75cfd73f3f0 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -246,3 +246,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 0d6a847a341..de354f234c7 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -258,3 +258,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index cc56e1f6aef..a528c3e6b36 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -251,3 +251,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index b792864b9f4..5473f4e8e42 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 2b6825adb8a..0b91786d1f3 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -255,3 +255,4 @@ "Every derived table must have it's own alias" "Select %u was скасовано при оптимiзацii", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f8a3350f051..e4531e7a2bf 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -189,9 +189,9 @@ end: static int check_user(THD *thd,enum_server_command command, const char *user, const char *passwd, const char *db, bool check_count, - bool do_send_error, char* crypted_scramble, - bool had_password,uint *cur_priv_version, - ACL_USER** hint_user) + bool simple_connect, bool do_send_error, + char* crypted_scramble, bool had_password, + uint *cur_priv_version, ACL_USER** hint_user) { thd->db=0; thd->db_length=0; @@ -222,14 +222,23 @@ static int check_user(THD *thd,enum_server_command command, const char *user, { if (do_send_error) { - net_printf(thd, ER_ACCESS_DENIED_ERROR, - thd->user, - thd->host_or_ip, - had_password ? ER(ER_YES) : ER(ER_NO)); - mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), - thd->user, - thd->host_or_ip, - had_password ? ER(ER_YES) : ER(ER_NO)); + /* Old client should get nicer error message if password version is not supported*/ + if (simple_connect && *hint_user && (*hint_user)->pversion) + { + net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE); + mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE)); + } + else + { + net_printf(thd, ER_ACCESS_DENIED_ERROR, + thd->user, + thd->host_or_ip, + had_password ? ER(ER_YES) : ER(ER_NO)); + mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), + thd->user, + thd->host_or_ip, + had_password ? ER(ER_YES) : ER(ER_NO)); + } return(1); // Error already given } else @@ -638,8 +647,9 @@ check_connections(THD *thd) /* Store information if we used password. passwd will be dammaged */ bool using_password=test(passwd[0]); /* Check user permissions. If password failure we'll get scramble back */ - if (check_user(thd,COM_CONNECT, user, passwd, db, 1, simple_connect, - prepared_scramble,using_password,&cur_priv_version,&cached_user)<0) + if (check_user(thd, COM_CONNECT, user, passwd, db, 1, simple_connect, + simple_connect, prepared_scramble, using_password, &cur_priv_version, + &cached_user)<0) { /* If The client is old we just have to return error */ if (simple_connect) @@ -679,7 +689,7 @@ check_connections(THD *thd) } /* Final attempt to check the user based on reply */ if (check_user(thd,COM_CONNECT, tmp_user, (char*)net->read_pos, - tmp_db, 1, 1,prepared_scramble,using_password,&cur_priv_version, + tmp_db, 1, 0, 1, prepared_scramble, using_password, &cur_priv_version, &cached_user)) return -1; } @@ -1077,7 +1087,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Do not retry if we already have sent error (result>0) */ if (check_user(thd,COM_CHANGE_USER, user, passwd, db, 0, simple_connect, - prepared_scramble,using_password,&cur_priv_version,&cached_user)<0) + simple_connect, prepared_scramble, using_password, &cur_priv_version, + &cached_user)<0) { /* If The client is old we just have to have auth failure */ if (simple_connect) @@ -1112,7 +1123,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, /* Final attempt to check the user based on reply */ if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*)net->read_pos, - tmp_db, 0, 1,prepared_scramble,using_password,&cur_priv_version, + tmp_db, 0, 0, 1, prepared_scramble, using_password, &cur_priv_version, &cached_user)) goto restore_user; }