mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
WL1019: complete patch. Reapplied patch to the clean
tree to get rid of multiple typos in CS comments and unify the patch.
This commit is contained in:
@@ -73,14 +73,23 @@ static bool append_file_to_dir(THD *thd, const char **filename_ptr,
|
||||
|
||||
const char *any_db="*any*"; // Special symbol for check_access
|
||||
|
||||
const char *command_name[]={
|
||||
"Sleep", "Quit", "Init DB", "Query", "Field List", "Create DB",
|
||||
"Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist",
|
||||
"Connect","Kill","Debug","Ping","Time","Delayed insert","Change user",
|
||||
"Binlog Dump","Table Dump", "Connect Out", "Register Slave",
|
||||
"Prepare", "Execute", "Long Data", "Close stmt",
|
||||
"Reset stmt", "Set option", "Fetch", "Daemon",
|
||||
"Error" // Last command number
|
||||
LEX_STRING command_name[]={
|
||||
STRING_WITH_LEN("Sleep"), STRING_WITH_LEN("Quit"),
|
||||
STRING_WITH_LEN("Init DB"), STRING_WITH_LEN("Query"),
|
||||
STRING_WITH_LEN("Field List"), STRING_WITH_LEN("Create DB"),
|
||||
STRING_WITH_LEN("Drop DB"), STRING_WITH_LEN("Refresh"),
|
||||
STRING_WITH_LEN("Shutdown"), STRING_WITH_LEN("Statistics"),
|
||||
STRING_WITH_LEN("Processlist"), STRING_WITH_LEN("Connect"),
|
||||
STRING_WITH_LEN("Kill"), STRING_WITH_LEN("Debug"),
|
||||
STRING_WITH_LEN("Ping"), STRING_WITH_LEN("Time"),
|
||||
STRING_WITH_LEN("Delayed insert"), STRING_WITH_LEN("Change user"),
|
||||
STRING_WITH_LEN("Binlog Dump"), STRING_WITH_LEN("Table Dump"),
|
||||
STRING_WITH_LEN("Connect Out"), STRING_WITH_LEN("Register Slave"),
|
||||
STRING_WITH_LEN("Prepare"), STRING_WITH_LEN("Execute"),
|
||||
STRING_WITH_LEN("Long Data"), STRING_WITH_LEN("Close stmt"),
|
||||
STRING_WITH_LEN("Reset stmt"), STRING_WITH_LEN("Set option"),
|
||||
STRING_WITH_LEN("Fetch"), STRING_WITH_LEN("Daemon"),
|
||||
STRING_WITH_LEN("Error") // Last command number
|
||||
};
|
||||
|
||||
const char *xa_state_names[]={
|
||||
@@ -322,7 +331,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
||||
if (opt_secure_auth_local && passwd_len == SCRAMBLE_LENGTH_323)
|
||||
{
|
||||
net_printf_error(thd, ER_NOT_SUPPORTED_AUTH_MODE);
|
||||
mysql_log.write(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
|
||||
general_log_print(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (passwd_len != 0 &&
|
||||
@@ -356,9 +365,9 @@ int check_user(THD *thd, enum enum_server_command command,
|
||||
net_printf_error(thd, ER_SERVER_IS_IN_SECURE_AUTH_MODE,
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip);
|
||||
mysql_log.write(thd, COM_CONNECT, ER(ER_SERVER_IS_IN_SECURE_AUTH_MODE),
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip);
|
||||
general_log_print(thd, COM_CONNECT, ER(ER_SERVER_IS_IN_SECURE_AUTH_MODE),
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
/* We have to read very specific packet size */
|
||||
@@ -406,14 +415,14 @@ int check_user(THD *thd, enum enum_server_command command,
|
||||
}
|
||||
|
||||
/* Why logging is performed before all checks've passed? */
|
||||
mysql_log.write(thd, command,
|
||||
(thd->main_security_ctx.priv_user ==
|
||||
thd->main_security_ctx.user ?
|
||||
(char*) "%s@%s on %s" :
|
||||
(char*) "%s@%s as anonymous on %s"),
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip,
|
||||
db ? db : (char*) "");
|
||||
general_log_print(thd, command,
|
||||
(thd->main_security_ctx.priv_user ==
|
||||
thd->main_security_ctx.user ?
|
||||
(char*) "%s@%s on %s" :
|
||||
(char*) "%s@%s as anonymous on %s"),
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip,
|
||||
db ? db : (char*) "");
|
||||
|
||||
/*
|
||||
This is the default access rights for the current database. It's
|
||||
@@ -460,17 +469,17 @@ int check_user(THD *thd, enum enum_server_command command,
|
||||
else if (res == 2) // client gave short hash, server has long hash
|
||||
{
|
||||
net_printf_error(thd, ER_NOT_SUPPORTED_AUTH_MODE);
|
||||
mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE));
|
||||
general_log_print(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
net_printf_error(thd, ER_ACCESS_DENIED_ERROR,
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip,
|
||||
passwd_len ? ER(ER_YES) : ER(ER_NO));
|
||||
mysql_log.write(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_ERROR),
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip,
|
||||
passwd_len ? ER(ER_YES) : ER(ER_NO));
|
||||
general_log_print(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_ERROR),
|
||||
thd->main_security_ctx.user,
|
||||
thd->main_security_ctx.host_or_ip,
|
||||
passwd_len ? ER(ER_YES) : ER(ER_NO));
|
||||
DBUG_RETURN(-1);
|
||||
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
|
||||
}
|
||||
@@ -1570,7 +1579,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
packet, strlen(packet), thd->charset());
|
||||
if (!mysql_change_db(thd, tmp.str, FALSE))
|
||||
{
|
||||
mysql_log.write(thd,command,"%s",thd->db);
|
||||
general_log_print(thd, command, "%s",thd->db);
|
||||
send_ok(thd);
|
||||
}
|
||||
break;
|
||||
@@ -1703,7 +1712,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
if (alloc_query(thd, packet, packet_length))
|
||||
break; // fatal error is set
|
||||
char *packet_end= thd->query + thd->query_length;
|
||||
mysql_log.write(thd,command,"%s",thd->query);
|
||||
general_log_print(thd, command, "%s", thd->query);
|
||||
DBUG_PRINT("query",("%-.4096s",thd->query));
|
||||
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
@@ -1812,7 +1821,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->query_length= strlen(packet); // for simplicity: don't optimize
|
||||
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
|
||||
break;
|
||||
mysql_log.write(thd,command,"%s %s",table_list.table_name, fields);
|
||||
general_log_print(thd, command, "%s %s", table_list.table_name, fields);
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(files_charset_info, table_list.table_name);
|
||||
remove_escape(table_list.table_name); // This can't have wildcards
|
||||
@@ -1841,7 +1850,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
#endif
|
||||
case COM_QUIT:
|
||||
/* We don't calculate statistics for this command */
|
||||
mysql_log.write(thd,command,NullS);
|
||||
general_log_print(thd, command, NullS);
|
||||
net->error=0; // Don't give 'abort' message
|
||||
error=TRUE; // End server
|
||||
break;
|
||||
@@ -1861,7 +1870,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
}
|
||||
if (check_access(thd,CREATE_ACL,db,0,1,0,is_schema_db(db)))
|
||||
break;
|
||||
mysql_log.write(thd,command,packet);
|
||||
general_log_print(thd, command, packet);
|
||||
bzero(&create_info, sizeof(create_info));
|
||||
mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db),
|
||||
&create_info, 0);
|
||||
@@ -1886,7 +1895,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
|
||||
break;
|
||||
}
|
||||
mysql_log.write(thd,command,db);
|
||||
general_log_print(thd, command, db);
|
||||
mysql_rm_db(thd, db, 0, 0);
|
||||
break;
|
||||
}
|
||||
@@ -1910,7 +1919,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
kill_zombie_dump_threads(slave_server_id);
|
||||
thd->server_id = slave_server_id;
|
||||
|
||||
mysql_log.write(thd, command, "Log: '%s' Pos: %ld", packet+10,
|
||||
general_log_print(thd, command, "Log: '%s' Pos: %ld", packet+10,
|
||||
(long) pos);
|
||||
mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
|
||||
unregister_slave(thd,1,1);
|
||||
@@ -1928,7 +1937,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
ulong options= (ulong) (uchar) packet[0];
|
||||
if (check_global_access(thd,RELOAD_ACL))
|
||||
break;
|
||||
mysql_log.write(thd,command,NullS);
|
||||
general_log_print(thd, command, NullS);
|
||||
if (!reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, ¬_used))
|
||||
send_ok(thd);
|
||||
break;
|
||||
@@ -1956,7 +1965,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
break;
|
||||
}
|
||||
DBUG_PRINT("quit",("Got shutdown command for level %u", level));
|
||||
mysql_log.write(thd,command,NullS);
|
||||
general_log_print(thd, command, NullS);
|
||||
send_eof(thd);
|
||||
#ifdef __WIN__
|
||||
sleep(1); // must wait after eof()
|
||||
@@ -1973,7 +1982,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
#endif
|
||||
case COM_STATISTICS:
|
||||
{
|
||||
mysql_log.write(thd,command,NullS);
|
||||
general_log_print(thd, command, NullS);
|
||||
statistic_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS],
|
||||
&LOCK_status);
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
@@ -2013,7 +2022,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
if (!thd->security_ctx->priv_user[0] &&
|
||||
check_global_access(thd, PROCESS_ACL))
|
||||
break;
|
||||
mysql_log.write(thd,command,NullS);
|
||||
general_log_print(thd, command, NullS);
|
||||
mysqld_list_processes(thd,
|
||||
thd->security_ctx->master_access & PROCESS_ACL ?
|
||||
NullS : thd->security_ctx->priv_user, 0);
|
||||
@@ -2050,7 +2059,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
break; /* purecov: inspected */
|
||||
mysql_print_status();
|
||||
mysql_log.write(thd,command,NullS);
|
||||
general_log_print(thd, command, NullS);
|
||||
send_eof(thd);
|
||||
break;
|
||||
case COM_SLEEP:
|
||||
@@ -2132,7 +2141,7 @@ void log_slow_statement(THD *thd)
|
||||
(specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES)))
|
||||
{
|
||||
thd->status_var.long_query_count++;
|
||||
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
|
||||
slow_log_print(thd, thd->query, thd->query_length, start_of_query);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6541,7 +6550,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
||||
{
|
||||
/*
|
||||
Flush the normal query log, the update log, the binary log,
|
||||
the slow query log, and the relay log (if it exists).
|
||||
the slow query log, the relay log (if it exists) and the log
|
||||
tables.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -6551,14 +6561,16 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
||||
than it would help them)
|
||||
*/
|
||||
tmp_write_to_binlog= 0;
|
||||
mysql_log.new_file(1);
|
||||
mysql_slow_log.new_file(1);
|
||||
mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
|
||||
#ifdef HAVE_REPLICATION
|
||||
pthread_mutex_lock(&LOCK_active_mi);
|
||||
rotate_relay_log(active_mi);
|
||||
pthread_mutex_unlock(&LOCK_active_mi);
|
||||
#endif
|
||||
|
||||
/* flush slow and general logs */
|
||||
logger.flush_logs(thd);
|
||||
|
||||
if (ha_flush_logs(NULL))
|
||||
result=1;
|
||||
if (flush_error_log())
|
||||
|
||||
Reference in New Issue
Block a user