mirror of
https://github.com/MariaDB/server.git
synced 2025-09-13 13:47:59 +03:00
merge mysql-5.5->mysql-5.5-security
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define HA_PARTITION_INCLUDED
|
||||
|
||||
/*
|
||||
Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -197,9 +197,9 @@ public:
|
||||
*/
|
||||
ha_partition(handlerton *hton, TABLE_SHARE * table);
|
||||
ha_partition(handlerton *hton, partition_info * part_info);
|
||||
ha_partition(handlerton *hton, TABLE_SHARE *share,
|
||||
partition_info *part_info_arg,
|
||||
ha_partition *clone_arg,
|
||||
ha_partition(handlerton *hton, TABLE_SHARE *share,
|
||||
partition_info *part_info_arg,
|
||||
ha_partition *clone_arg,
|
||||
MEM_ROOT *clone_mem_root_arg);
|
||||
~ha_partition();
|
||||
/*
|
||||
@@ -541,6 +541,20 @@ public:
|
||||
virtual int extra(enum ha_extra_function operation);
|
||||
virtual int extra_opt(enum ha_extra_function operation, ulong cachesize);
|
||||
virtual int reset(void);
|
||||
/*
|
||||
Do not allow caching of partitioned tables, since we cannot return
|
||||
a callback or engine_data that would work for a generic engine.
|
||||
*/
|
||||
virtual my_bool register_query_cache_table(THD *thd, char *table_key,
|
||||
uint key_length,
|
||||
qc_engine_callback
|
||||
*engine_callback,
|
||||
ulonglong *engine_data)
|
||||
{
|
||||
*engine_callback= NULL;
|
||||
*engine_data= 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint NO_CURRENT_PART_ID;
|
||||
|
@@ -3291,7 +3291,7 @@ String *Item_param::val_str(String* str)
|
||||
that binary log contains wrong statement
|
||||
*/
|
||||
|
||||
const String *Item_param::query_val_str(String* str) const
|
||||
const String *Item_param::query_val_str(THD *thd, String* str) const
|
||||
{
|
||||
switch (state) {
|
||||
case INT_VALUE:
|
||||
@@ -3329,7 +3329,8 @@ const String *Item_param::query_val_str(String* str) const
|
||||
case LONG_DATA_VALUE:
|
||||
{
|
||||
str->length(0);
|
||||
append_query_string(value.cs_info.character_set_client, &str_value, str);
|
||||
append_query_string(thd, value.cs_info.character_set_client, &str_value,
|
||||
str);
|
||||
break;
|
||||
}
|
||||
case NULL_VALUE:
|
||||
@@ -3462,7 +3463,7 @@ void Item_param::print(String *str, enum_query_type query_type)
|
||||
char buffer[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmp(buffer, sizeof(buffer), &my_charset_bin);
|
||||
const String *res;
|
||||
res= query_val_str(&tmp);
|
||||
res= query_val_str(current_thd, &tmp);
|
||||
str->append(*res);
|
||||
}
|
||||
}
|
||||
|
@@ -1948,7 +1948,7 @@ public:
|
||||
*/
|
||||
void (*set_param_func)(Item_param *param, uchar **pos, ulong len);
|
||||
|
||||
const String *query_val_str(String *str) const;
|
||||
const String *query_val_str(THD *thd, String *str) const;
|
||||
|
||||
bool convert_str_value(THD *thd);
|
||||
|
||||
|
@@ -271,7 +271,7 @@ public:
|
||||
Item_in_optimizer(Item *a, Item_in_subselect *b):
|
||||
Item_bool_func(a, reinterpret_cast<Item *>(b)), cache(0),
|
||||
save_cache(0), result_for_null_param(UNKNOWN)
|
||||
{}
|
||||
{ with_subselect= true; }
|
||||
bool fix_fields(THD *, Item **);
|
||||
bool fix_left(THD *thd, Item **ref);
|
||||
bool is_null();
|
||||
|
@@ -585,7 +585,7 @@ char *str_to_hex(char *to, const char *from, uint len)
|
||||
*/
|
||||
|
||||
int
|
||||
append_query_string(CHARSET_INFO *csinfo,
|
||||
append_query_string(THD *thd, CHARSET_INFO *csinfo,
|
||||
String const *from, String *to)
|
||||
{
|
||||
char *beg, *ptr;
|
||||
@@ -600,9 +600,26 @@ append_query_string(CHARSET_INFO *csinfo,
|
||||
else
|
||||
{
|
||||
*ptr++= '\'';
|
||||
ptr+= escape_string_for_mysql(csinfo, ptr, 0,
|
||||
from->ptr(), from->length());
|
||||
*ptr++='\'';
|
||||
if (!(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES))
|
||||
{
|
||||
ptr+= escape_string_for_mysql(csinfo, ptr, 0,
|
||||
from->ptr(), from->length());
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *frm_str= from->ptr();
|
||||
|
||||
for (; frm_str < (from->ptr() + from->length()); frm_str++)
|
||||
{
|
||||
/* Using '' way to represent "'" */
|
||||
if (*frm_str == '\'')
|
||||
*ptr++= *frm_str;
|
||||
|
||||
*ptr++= *frm_str;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr++= '\'';
|
||||
}
|
||||
to->length(orig_len + ptr - beg);
|
||||
return 0;
|
||||
|
@@ -4082,7 +4082,7 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
int append_query_string(CHARSET_INFO *csinfo,
|
||||
int append_query_string(THD *thd, CHARSET_INFO *csinfo,
|
||||
String const *from, String *to);
|
||||
|
||||
/**
|
||||
|
@@ -656,7 +656,7 @@ int mysqld_server_started= 0;
|
||||
File_parser_dummy_hook file_parser_dummy_hook;
|
||||
|
||||
/* replication parameters, if master_host is not NULL, we are a slave */
|
||||
uint report_port= MYSQL_PORT;
|
||||
uint report_port= 0;
|
||||
ulong master_retry_count=0;
|
||||
char *master_info_file;
|
||||
char *relay_log_info_file, *report_user, *report_password, *report_host;
|
||||
@@ -1784,6 +1784,11 @@ static void network_init(void)
|
||||
|
||||
set_ports();
|
||||
|
||||
if (report_port == 0)
|
||||
{
|
||||
report_port= mysqld_port;
|
||||
}
|
||||
DBUG_ASSERT(report_port != 0);
|
||||
if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap)
|
||||
{
|
||||
struct addrinfo *ai, *a;
|
||||
@@ -2406,10 +2411,6 @@ static void check_data_home(const char *path)
|
||||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
#define UNSAFE_DEFAULT_LINUX_THREADS 200
|
||||
#endif
|
||||
|
||||
|
||||
#if BACKTRACE_DEMANGLE
|
||||
#include <cxxabi.h>
|
||||
|
@@ -131,6 +131,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
"Hope that's ok; if not, decrease some variables in the equation.\n\n");
|
||||
|
||||
#if defined(HAVE_LINUXTHREADS)
|
||||
#define UNSAFE_DEFAULT_LINUX_THREADS 200
|
||||
if (sizeof(char*) == 4 && thread_count > UNSAFE_DEFAULT_LINUX_THREADS)
|
||||
{
|
||||
my_safe_printf_stderr(
|
||||
|
@@ -169,7 +169,7 @@ sp_get_item_value(THD *thd, Item *item, String *str)
|
||||
buf.append(result->charset()->csname);
|
||||
if (cs->escape_with_backslash_is_dangerous)
|
||||
buf.append(' ');
|
||||
append_query_string(cs, result, &buf);
|
||||
append_query_string(thd, cs, result, &buf);
|
||||
buf.append(" COLLATE '");
|
||||
buf.append(item->collation.collation->name);
|
||||
buf.append('\'');
|
||||
|
@@ -885,7 +885,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
|
||||
*/
|
||||
else if (! is_param_long_data_type(param))
|
||||
DBUG_RETURN(1);
|
||||
res= param->query_val_str(&str);
|
||||
res= param->query_val_str(thd, &str);
|
||||
if (param->convert_str_value(thd))
|
||||
DBUG_RETURN(1); /* out of memory */
|
||||
|
||||
@@ -1059,7 +1059,7 @@ static bool emb_insert_params_with_log(Prepared_statement *stmt,
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
res= param->query_val_str(&str);
|
||||
res= param->query_val_str(thd, &str);
|
||||
if (param->convert_str_value(thd))
|
||||
DBUG_RETURN(1); /* out of memory */
|
||||
|
||||
@@ -1205,7 +1205,7 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
|
||||
setup_one_conversion_function(thd, param, param->param_type);
|
||||
if (param->set_from_user_var(thd, entry))
|
||||
DBUG_RETURN(1);
|
||||
val= param->query_val_str(&buf);
|
||||
val= param->query_val_str(thd, &buf);
|
||||
|
||||
if (param->convert_str_value(thd))
|
||||
DBUG_RETURN(1); /* out of memory */
|
||||
|
@@ -2768,7 +2768,7 @@ static Sys_var_uint Sys_repl_report_port(
|
||||
"port or if you have a special tunnel from the master or other clients "
|
||||
"to the slave. If not sure, leave this option unset",
|
||||
READ_ONLY GLOBAL_VAR(report_port), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(0, UINT_MAX), DEFAULT(MYSQL_PORT), BLOCK_SIZE(1));
|
||||
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
|
||||
#endif
|
||||
|
||||
static Sys_var_mybool Sys_keep_files_on_create(
|
||||
|
Reference in New Issue
Block a user