diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/CMakeLists.txt | 8 | ||||
-rw-r--r-- | sql/ha_ndbcluster.cc | 3 | ||||
-rw-r--r-- | sql/ha_partition.cc | 3 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 3 | ||||
-rw-r--r-- | sql/log.cc | 3 | ||||
-rw-r--r-- | sql/share/errmsg-utf8.txt | 6 | ||||
-rw-r--r-- | sql/sql_acl.cc | 39 | ||||
-rw-r--r-- | sql/sql_class.cc | 2 | ||||
-rw-r--r-- | sql/sql_error.cc | 4 | ||||
-rw-r--r-- | sql/sql_lex.cc | 3 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 32 | ||||
-rw-r--r-- | sql/sql_union.cc | 38 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 15 |
13 files changed, 121 insertions, 38 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index f95cc359439..fb86d1ce60f 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -100,6 +100,14 @@ ENDIF() MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server) +IF(APPLE) + # Add CoreServices framework since some dloadable plugins may need it + FIND_LIBRARY(CORESERVICES NAMES CoreServices) + IF(CORESERVICES) + TARGET_LINK_LIBRARIES(mysqld ${CORESERVICES}) + ENDIF() +ENDIF() + IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) GET_TARGET_PROPERTY(mysqld_link_flags mysqld LINK_FLAGS) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index ac47c8dbc0e..610425ab735 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -11023,7 +11023,8 @@ mysql_declare_plugin(ndbcluster) 0x0100 /* 1.0 */, ndb_status_variables_export,/* status variables */ system_variables, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 9e22553ef0e..82bd39220a9 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -7183,7 +7183,8 @@ mysql_declare_plugin(partition) 0x0100, /* 1.0 */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 9ea9cbc7312..55087879b98 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2316,7 +2316,7 @@ String *Item_func_format::val_str_ascii(String *str) return 0; /* purecov: inspected */ nr= my_double_round(nr, (longlong) dec, FALSE, FALSE); str->set_real(nr, dec, &my_charset_numeric); - if (isnan(nr)) + if (isnan(nr) || my_isinf(nr)) return str; str_length=str->length(); } @@ -2372,6 +2372,7 @@ String *Item_func_format::val_str_ascii(String *str) For short values without thousands (<1000) replace decimal point to localized value. */ + DBUG_ASSERT(dec_length <= str_length); ((char*) str->ptr())[str_length - dec_length]= lc->decimal_point; } return str; diff --git a/sql/log.cc b/sql/log.cc index 9080dcd7fa2..c6b41447d6a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -6604,6 +6604,7 @@ mysql_declare_plugin(binlog) 0x0100 /* 1.0 */, NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 58dea797dda..c04106025a7 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6420,3 +6420,9 @@ ER_INDEX_CORRUPT ER_UNDO_RECORD_TOO_BIG eng "Undo log record is too big." + +ER_PLUGIN_NO_UNINSTALL + eng "Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it." + +ER_PLUGIN_NO_INSTALL + eng "Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it." diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f4d217c85ff..3f236dd672f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1881,17 +1881,17 @@ bool change_password(THD *thd, const char *host, const char *user, goto end; } + /* update loaded acl entry: */ + set_user_salt(acl_user, new_password, new_password_len); + if (my_strcasecmp(system_charset_info, acl_user->plugin.str, native_password_plugin_name.str) && my_strcasecmp(system_charset_info, acl_user->plugin.str, old_password_plugin_name.str)) - { push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SET_PASSWORD_AUTH_PLUGIN, ER(ER_SET_PASSWORD_AUTH_PLUGIN)); - } - /* update loaded acl entry: */ - set_user_salt(acl_user, new_password, new_password_len); - set_user_plugin(acl_user, new_password_len); + else + set_user_plugin(acl_user, new_password_len); if (update_user_table(thd, table, acl_user->host.hostname ? acl_user->host.hostname : "", @@ -8820,24 +8820,18 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, /** - Make sure that when sending plugin supplued data to the client they + Make sure that when sending plugin supplied data to the client they are not considered a special out-of-band command, like e.g. - \255 (error) or \254 (change user request packet). - To avoid this we send plugin data packets starting with one of these - 2 bytes "wrapped" in a command \1. - For the above reason we have to wrap plugin data packets starting with - \1 as well. + \255 (error) or \254 (change user request packet) or \0 (OK). + To avoid this the server will send all plugin data packets "wrapped" + in a command \1. + Note that the client will continue sending its replies unrwapped. */ -#define IS_OUT_OF_BAND_PACKET(packet,packet_len) \ - ((packet_len) > 0 && \ - (*(packet) == 1 || *(packet) == 255 || *(packet) == 254)) - static inline int wrap_plguin_data_into_proper_command(NET *net, const uchar *packet, int packet_len) { - DBUG_ASSERT(IS_OUT_OF_BAND_PACKET(packet, packet_len)); return net_write_command(net, 1, (uchar *) "", 0, packet, packet_len); } @@ -8874,13 +8868,8 @@ static int server_mpvio_write_packet(MYSQL_PLUGIN_VIO *param, res= send_server_handshake_packet(mpvio, (char*) packet, packet_len); else if (mpvio->status == MPVIO_EXT::RESTART) res= send_plugin_request_packet(mpvio, packet, packet_len); - else if (IS_OUT_OF_BAND_PACKET(packet, packet_len)) - res= wrap_plguin_data_into_proper_command(mpvio->net, packet, packet_len); else - { - res= my_net_write(mpvio->net, packet, packet_len) || - net_flush(mpvio->net); - } + res= wrap_plguin_data_into_proper_command(mpvio->net, packet, packet_len); mpvio->packets_written++; DBUG_RETURN(res); } @@ -9651,7 +9640,8 @@ mysql_declare_plugin(mysql_password) 0x0100, /* Version (1.0) */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ }, { MYSQL_AUTHENTICATION_PLUGIN, /* type constant */ @@ -9665,7 +9655,8 @@ mysql_declare_plugin(mysql_password) 0x0100, /* Version (1.0) */ NULL, /* status variables */ NULL, /* system variables */ - NULL /* config options */ + NULL, /* config options */ + 0, /* flags */ } mysql_declare_plugin_end; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0b1de2c47fa..9b5772d3d07 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -641,7 +641,7 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length, { String str(buffer, length, &my_charset_latin1); const Security_context *sctx= &thd->main_security_ctx; - char header[64]; + char header[256]; int len; /* The pointers thd->query and thd->proc_info might change since they are diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 24516f03bee..443f3b7a33e 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -803,14 +803,16 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs, my_wc_t wc; const uchar *from_end= (const uchar*) from+from_length; char *to_start= to; - uchar *to_end= (uchar*) to+to_length; + uchar *to_end; my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc; my_charset_conv_wc_mb wc_mb; uint error_count= 0; uint length; DBUG_ASSERT(to_length > 0); + /* Make room for the null terminator. */ to_length--; + to_end= (uchar*) (to + to_length); if (!to_cs || from_cs == to_cs || to_cs == &my_charset_bin) { diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1cc967c5055..3e6052d3561 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2121,6 +2121,9 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) if (ref_pointer_array) return 0; + // find_order_in_list() may need some extra space, so multiply by two. + order_group_num*= 2; + /* We have to create array in prepared statement memory if it is prepared statement diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 015cbe31a15..5f5e73091ff 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -539,6 +539,11 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) #endif } + /* + What's the purpose of this loop? If the goal is to catch a + missing 0 record at the end of a list, it will fail miserably + since the compiler is likely to optimize this away. /Matz + */ for (i= 0; ((struct st_mysql_plugin *)(ptr+i*sizeof_st_plugin))->info; i++) @@ -567,6 +572,23 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) } plugin_dl.plugins= (struct st_mysql_plugin *)sym; + /* + If report is REPORT_TO_USER, we were called from + mysql_install_plugin. Otherwise, we are called directly or + indirectly from plugin_init. + */ + if (report == REPORT_TO_USER) + { + st_mysql_plugin *plugin= plugin_dl.plugins; + for ( ; plugin->info ; ++plugin) + if (plugin->flags & PLUGIN_OPT_NO_INSTALL) + { + report_error(report, ER_PLUGIN_NO_INSTALL, plugin->name); + free_plugin_mem(&plugin_dl); + DBUG_RETURN(0); + } + } + /* Duplicate and convert dll name */ plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1; if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0)))) @@ -1884,6 +1906,16 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name) my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str); goto err; } + /* + Error message for ER_PLUGIN_IS_PERMANENT is not suitable for + plugins marked as not dynamically uninstallable, so we have a + separate one instead of changing the old one. + */ + if (plugin->plugin->flags & PLUGIN_OPT_NO_UNINSTALL) + { + my_error(ER_PLUGIN_NO_UNINSTALL, MYF(0), plugin->plugin->name); + goto err; + } plugin->state= PLUGIN_IS_DELETED; if (plugin->ref_count) diff --git a/sql/sql_union.cc b/sql/sql_union.cc index d34027ddc86..b0a25c2df97 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, 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 @@ -404,15 +404,27 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, fake_select_lex->table_list.empty(); DBUG_RETURN(TRUE); } + + /* + Fake st_select_lex should have item list for correct ref_array + allocation. + */ fake_select_lex->item_list= item_list; thd_arg->lex->current_select= fake_select_lex; + + /* + We need to add up n_sum_items in order to make the correct + allocation in setup_ref_array(). + */ + fake_select_lex->n_child_sum_items+= global_parameters->n_sum_items; + saved_error= fake_select_lex->join-> prepare(&fake_select_lex->ref_pointer_array, fake_select_lex->table_list.first, 0, 0, - fake_select_lex->order_list.elements, - fake_select_lex->order_list.first, + global_parameters->order_list.elements, // og_num + global_parameters->order_list.first, // order NULL, NULL, NULL, fake_select_lex, this); fake_select_lex->table_list.empty(); @@ -581,11 +593,21 @@ bool st_select_lex_unit::exec() } fake_select_lex->join->no_const_tables= TRUE; - /* - Fake st_select_lex should have item list for correctref_array - allocation. - */ - fake_select_lex->item_list= item_list; + /* + Fake st_select_lex should have item list for correct ref_array + allocation. + */ + fake_select_lex->item_list= item_list; + + /* + We need to add up n_sum_items in order to make the correct + allocation in setup_ref_array(). + Don't add more sum_items if we have already done JOIN::prepare + for this (with a different join object) + */ + if (!fake_select_lex->ref_pointer_array) + fake_select_lex->n_child_sum_items+= global_parameters->n_sum_items; + saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array, &result_table_list, 0, item_list, NULL, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 700995d5bb6..145c6c86714 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -8644,6 +8644,11 @@ function_call_generic: Create_func *builder; Item *item= NULL; + if (check_routine_name(&$1)) + { + MYSQL_YYABORT; + } + /* Implementation note: names are resolved with the following order: @@ -8707,6 +8712,16 @@ function_call_generic: version() (a vendor can specify any schema). */ + if (!$1.str || check_db_name(&$1)) + { + my_error(ER_WRONG_DB_NAME, MYF(0), $1.str); + MYSQL_YYABORT; + } + if (check_routine_name(&$3)) + { + MYSQL_YYABORT; + } + builder= find_qualified_function_builder(thd); DBUG_ASSERT(builder); item= builder->create(thd, $1, $3, true, $5); |