1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fixed some things to make MySQL to compile again.

libmysqld/lib_sql.cc:
  Fix to make the embedded server compile with the new USER_REOSURCEs.
sql/sql_acl.cc:
  Fixed wrong test in password checking.
sql/sql_cache.cc:
  Fixed wrong cast
sql/sql_parse.cc:
  Cleanup
This commit is contained in:
unknown
2002-05-15 18:41:36 +03:00
parent 68f972b5d4
commit dc2b6e456f
4 changed files with 14 additions and 15 deletions

View File

@ -236,7 +236,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
const char *passwd, const char *db, bool check_count) const char *passwd, const char *db, bool check_count)
{ {
NET *net= &thd->net; NET *net= &thd->net;
uint max=0; USER_RESOURCES ur;
thd->db=0; thd->db=0;
if (!(thd->user = my_strdup(user, MYF(0)))) if (!(thd->user = my_strdup(user, MYF(0))))
@ -248,22 +248,22 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
passwd, thd->scramble, &thd->priv_user, passwd, thd->scramble, &thd->priv_user,
protocol_version == 9 || protocol_version == 9 ||
!(thd->client_capabilities & !(thd->client_capabilities &
CLIENT_LONG_PASSWORD),&max); CLIENT_LONG_PASSWORD),&ur);
DBUG_PRINT("general", DBUG_PRINT("info",
("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", ("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'",
thd->client_capabilities, thd->max_packet_length, thd->client_capabilities, thd->max_packet_length,
thd->host ? thd->host : thd->ip, thd->priv_user, thd->host_or_ip, thd->priv_user,
passwd[0] ? "yes": "no", passwd[0] ? "yes": "no",
thd->master_access, thd->db ? thd->db : "*none*")); thd->master_access, thd->db ? thd->db : "*none*"));
if (thd->master_access & NO_ACCESS) if (thd->master_access & NO_ACCESS)
{ {
net_printf(net, ER_ACCESS_DENIED_ERROR, net_printf(net, ER_ACCESS_DENIED_ERROR,
thd->user, thd->user,
thd->host ? thd->host : thd->ip, thd->host_or_ip,
passwd[0] ? ER(ER_YES) : ER(ER_NO)); passwd[0] ? ER(ER_YES) : ER(ER_NO));
mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR),
thd->user, thd->user,
thd->host ? thd->host : thd->ip ? thd->ip : "unknown ip", thd->host_or_ip,
passwd[0] ? ER(ER_YES) : ER(ER_NO)); passwd[0] ? ER(ER_YES) : ER(ER_NO));
return(1); // Error already given return(1); // Error already given
} }
@ -284,7 +284,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
(char*) "%s@%s on %s" : (char*) "%s@%s on %s" :
(char*) "%s@%s as anonymous on %s"), (char*) "%s@%s as anonymous on %s"),
user, user,
thd->host ? thd->host : thd->ip ? thd->ip : "unknown ip", thd->host_or_ip,
db ? db : (char*) ""); db ? db : (char*) "");
thd->db_access=0; thd->db_access=0;
if (db && db[0]) if (db && db[0])

View File

@ -1180,20 +1180,17 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
char *password,empty_string[1]; char *password,empty_string[1];
DBUG_ENTER("replace_user_table"); DBUG_ENTER("replace_user_table");
password=empty_string;
empty_string[0]=0;
if (combo.password.str && combo.password.str[0]) if (combo.password.str && combo.password.str[0])
{ {
if (combo.password.length <= HASH_PASSWORD_LENGTH) if (combo.password.length != HASH_PASSWORD_LENGTH)
{ {
send_error(&thd->net, ER_PASSWORD_NO_MATCH); send_error(&thd->net, ER_PASSWORD_NO_MATCH);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
password=combo.password.str; password=combo.password.str;
} }
else
{
password=empty_string;
empty_string[0]=0;
}
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(combo.user.str,combo.user.length); table->field[1]->store(combo.user.str,combo.user.length);

View File

@ -1071,7 +1071,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
DUMP(this); DUMP(this);
for ( ; tables_used; tables_used=tables_used->next) for ( ; tables_used; tables_used=tables_used->next)
{ {
invalidate_table((uchar *) tables_used->key, tables_used->key_length); invalidate_table((byte*) tables_used->key, tables_used->key_length);
DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key, DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key,
tables_used->table_name)); tables_used->table_name));
} }

View File

@ -242,7 +242,8 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
db ? db : (char*) ""); db ? db : (char*) "");
thd->db_access=0; thd->db_access=0;
/* Don't allow user to connect if he has done too many queries */ /* Don't allow user to connect if he has done too many queries */
if ((ur.questions || ur.updates || ur.connections) && get_or_create_user_conn(thd,user,thd->host_or_ip,&ur)) if ((ur.questions || ur.updates || ur.connections) &&
get_or_create_user_conn(thd,user,thd->host_or_ip,&ur))
return -1; return -1;
if (thd->user_connect && thd->user_connect->user_resources.connections && if (thd->user_connect && thd->user_connect->user_resources.connections &&
check_for_max_user_connections(thd->user_connect)) check_for_max_user_connections(thd->user_connect))
@ -259,6 +260,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
return 0; // ok return 0; // ok
} }
/* /*
Check for maximum allowable user connections, if the mysqld server is Check for maximum allowable user connections, if the mysqld server is
started with corresponding variable that is greater then 0. started with corresponding variable that is greater then 0.