From 0b7dad09acaf9e790f2e0a7f29aaddd0d9b07120 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Nov 2007 10:43:59 +0100 Subject: [PATCH 1/5] Bug#32429 ssl_cipher setting in my.cnf not read by libmysqlclient sql-common/client.c: Store ssl_cipher setting read from my.cnf into "option->ssl_cipher" --- sql-common/client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql-common/client.c b/sql-common/client.c index cb1d224ef2e..1fc73549520 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1085,11 +1085,16 @@ void mysql_read_default_options(struct st_mysql_options *options, my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME)); break; + case 26: /* ssl_cipher */ + my_free(options->ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + options->ssl_cipher= my_strdup(opt_arg, MYF(MY_WME)); + break; #else case 13: /* Ignore SSL options */ case 14: case 15: case 16: + case 26: break; #endif /* HAVE_OPENSSL */ case 17: /* charset-lib */ From bb681dbc883343ed2c503c15833720f8da499317 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Nov 2007 17:59:44 +0100 Subject: [PATCH 2/5] Bug #31153 calling stored procedure crashes server if available memory is low When the server was out of memory it crashed because of invalid memory access. This patch adds detection for failed memory allocations and make the server output a proper error message. sql/mysqld.cc: Don't try to push_warning from within push_warning. It will cause a recursion until the stack is consumed. If my_net_init fails (for example: because of OOM) the temporary vio object might have been attached to the thd object already. This will cause a double free on the vio object when the thd object is deleted later on and the server will crash. sql/sp_head.cc: Added check for out-of-memory on a 'new' operation. Refactored reset_lex method to return a error state code instead of void. Initialize the mem-root with init_sql_alloc to get a basic error handler for memory allocation problems. This alone won't prevent the server from crashing, NULL pointers have to be accounted for as well. sql/sp_head.h: Use the throw() clause in operator new, to indicate to the compiler that memory allocation can fail and return NULL, so that the compiler should generate code to check for NULL before invoking C++ constructors, to be crash safe. sql/sql_base.cc: Use init_sql_alloc to get basic out-of-memory error handling. sql/sql_lex.h: Use the throw() clause in operator new, to indicate to the compiler that memory allocation can fail and return NULL, so that the compiler should generate code to check for NULL before invoking C++ constructors, to be crash safe. sql/sql_prepare.cc: Use init_sql_alloc to get basic out-of-memory error handling. sql/sql_yacc.yy: Check for memory allocation failures where it matters. --- sql/mysqld.cc | 14 ++++- sql/sp_head.cc | 38 +++++++++--- sql/sp_head.h | 6 +- sql/sql_base.cc | 3 +- sql/sql_lex.h | 5 +- sql/sql_prepare.cc | 2 +- sql/sql_yacc.yy | 149 +++++++++++++++++++++++++++++++++++---------- 7 files changed, 168 insertions(+), 49 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 08c2b60fa79..89d7f3272ad 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2489,7 +2489,12 @@ static int my_message_sql(uint error, const char *str, myf MyFlags) thd->query_error= 1; // needed to catch query errors during replication if (!thd->no_warnings_for_error) + { + thd->no_warnings_for_error= TRUE; push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); + thd->no_warnings_for_error= FALSE; + } + /* thd->lex->current_select == 0 if lex structure is not inited (not query command (COM_QUERY)) @@ -4295,8 +4300,13 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused))) sock == unix_sock ? VIO_LOCALHOST: 0)) || my_net_init(&thd->net,vio_tmp)) { - if (vio_tmp) - vio_delete(vio_tmp); + /* + Only delete the temporary vio if we didn't already attach it to the + NET object. The destructor in THD will delete any initialized net + structure. + */ + if (vio_tmp && thd->net.vio != vio_tmp) + vio_delete(vio_tmp); else { (void) shutdown(new_sock, SHUT_RDWR); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 5ad6625efb8..3049ae5ccd3 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -411,14 +411,16 @@ check_routine_name(LEX_STRING ident) */ void * -sp_head::operator new(size_t size) +sp_head::operator new(size_t size) throw() { DBUG_ENTER("sp_head::operator new"); MEM_ROOT own_root; sp_head *sp; - init_alloc_root(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC); + init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC); sp= (sp_head *) alloc_root(&own_root, size); + if (sp == NULL) + return NULL; sp->main_mem_root= own_root; DBUG_PRINT("info", ("mem_root 0x%lx", (ulong) &sp->mem_root)); DBUG_RETURN(sp); @@ -429,6 +431,10 @@ sp_head::operator delete(void *ptr, size_t size) { DBUG_ENTER("sp_head::operator delete"); MEM_ROOT own_root; + + if (ptr == NULL) + DBUG_VOID_RETURN; + sp_head *sp= (sp_head *) ptr; /* Make a copy of main_mem_root as free_root will free the sp */ @@ -472,6 +478,9 @@ sp_head::init(LEX *lex) lex->spcont= m_pcont= new sp_pcontext(); + if (!lex->spcont) + DBUG_VOID_RETURN; + /* Altough trg_table_fields list is used only in triggers we init for all types of stored procedures to simplify reset_lex()/restore_lex() code. @@ -973,7 +982,7 @@ sp_head::execute(THD *thd) DBUG_RETURN(TRUE); /* init per-instruction memroot */ - init_alloc_root(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0); + init_sql_alloc(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0); DBUG_ASSERT(!(m_flags & IS_INVOKED)); m_flags|= IS_INVOKED; @@ -1795,16 +1804,29 @@ sp_head::execute_procedure(THD *thd, List *args) } -// Reset lex during parsing, before we parse a sub statement. -void +/** + @brief Reset lex during parsing, before we parse a sub statement. + + @param thd Thread handler. + + @return Error state + @retval true An error occurred. + @retval false Success. +*/ + +bool sp_head::reset_lex(THD *thd) { DBUG_ENTER("sp_head::reset_lex"); LEX *sublex; LEX *oldlex= thd->lex; + sublex= new (thd->mem_root)st_lex_local; + if (sublex == 0) + DBUG_RETURN(TRUE); + + thd->lex= sublex; (void)m_lex.push_front(oldlex); - thd->lex= sublex= new st_lex; /* Reset most stuff. */ lex_start(thd); @@ -1827,7 +1849,7 @@ sp_head::reset_lex(THD *thd) sublex->interval_list.empty(); sublex->type= 0; - DBUG_VOID_RETURN; + DBUG_RETURN(FALSE); } // Restore lex during parsing, after we have parsed a sub statement. @@ -3703,7 +3725,7 @@ sp_add_to_query_tables(THD *thd, LEX *lex, if (!(table= (TABLE_LIST *)thd->calloc(sizeof(TABLE_LIST)))) { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(TABLE_LIST)); + thd->fatal_error(); return NULL; } table->db_length= strlen(db); diff --git a/sql/sp_head.h b/sql/sp_head.h index ebe40ce9c87..cb243dd2503 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -191,10 +191,10 @@ public: Security_context m_security_ctx; static void * - operator new(size_t size); + operator new(size_t size) throw (); static void - operator delete(void *ptr, size_t size); + operator delete(void *ptr, size_t size) throw (); sp_head(); @@ -254,7 +254,7 @@ public: } // Resets lex in 'thd' and keeps a copy of the old one. - void + bool reset_lex(THD *thd); // Restores lex in 'thd' from our copy, but keeps some status from the diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 289924ff418..7ceed4e15d2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -80,7 +80,6 @@ bool Prelock_error_handler::safely_trapped_errors() return ((m_handled_errors > 0) && (m_unhandled_errors == 0)); } - TABLE *unused_tables; /* Used by mysql_test */ HASH open_cache; /* Used by mysql_test */ @@ -2643,7 +2642,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) temporary mem_root for new .frm parsing. TODO: variables for size */ - init_alloc_root(&new_frm_mem, 8024, 8024); + init_sql_alloc(&new_frm_mem, 8024, 8024); thd->current_tablenr= 0; restart: diff --git a/sql/sql_lex.h b/sql/sql_lex.h index ce56be79744..f216f51b0e4 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1283,11 +1283,11 @@ typedef struct st_lex : public Query_tables_list struct st_lex_local: public st_lex { - static void *operator new(size_t size) + static void *operator new(size_t size) throw() { return (void*) sql_alloc((uint) size); } - static void *operator new(size_t size, MEM_ROOT *mem_root) + static void *operator new(size_t size, MEM_ROOT *mem_root) throw() { return (void*) alloc_root(mem_root, (uint) size); } @@ -1303,3 +1303,4 @@ extern void lex_start(THD *thd); extern void lex_end(LEX *lex); extern int MYSQLlex(void *arg, void *yythd); extern char *skip_rear_comments(CHARSET_INFO *cs, char *begin, char *end); + diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index af3da834a7a..74cbd2c5505 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2659,7 +2659,7 @@ Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg) last_errno(0), flags((uint) IS_IN_USE) { - init_alloc_root(&main_mem_root, thd_arg->variables.query_alloc_block_size, + init_sql_alloc(&main_mem_root, thd_arg->variables.query_alloc_block_size, thd_arg->variables.query_prealloc_size); *last_error= '\0'; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 553cc6d24d5..3140ae4f7e3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1628,6 +1628,8 @@ create_function_tail: } /* Order is important here: new - reset - init */ sp= new sp_head(); + if (sp == NULL) + MYSQL_YYABORT; sp->reset_thd_mem_root(thd); sp->init(lex); sp->init_sp_name(thd, lex->spname); @@ -1929,7 +1931,8 @@ sp_decl: { LEX *lex= Lex; - lex->sphead->reset_lex(YYTHD); + if (lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; lex->spcont->declare_var_boundary($2); } type @@ -1937,6 +1940,10 @@ sp_decl: { LEX *lex= Lex; sp_pcontext *pctx= lex->spcont; + if (pctx == 0) + { + MYSQL_YYABORT; + } uint num_vars= pctx->context_var_count(); enum enum_field_types var_type= (enum enum_field_types) $4; Item *dflt_value_item= $5; @@ -2022,12 +2029,15 @@ sp_decl: { i= new sp_instr_hreturn(sp->instructions(), ctx, ctx->current_var_count()); + if (i == NULL ) + MYSQL_YYABORT; sp->add_instr(i); } else { /* EXIT or UNDO handler, just jump to the end of the block */ i= new sp_instr_hreturn(sp->instructions(), ctx, 0); - + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); sp->push_backpatch(i, lex->spcont->last_label()); /* Block end */ } @@ -2055,7 +2065,9 @@ sp_decl: } i= new sp_instr_cpush(sp->instructions(), ctx, $5, ctx->current_cursor_count()); - sp->add_instr(i); + if ( i==NULL ) + MYSQL_YYABORT; + sp->add_instr(i); ctx->push_cursor(&$2); $$.vars= $$.conds= $$.hndlrs= 0; $$.curs= 1; @@ -2064,7 +2076,8 @@ sp_decl: sp_cursor_stmt: { - Lex->sphead->reset_lex(YYTHD); + if(Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; /* We use statement here just be able to get a better error message. Using 'select' works too, but will then @@ -2230,7 +2243,8 @@ sp_proc_stmt: LEX *lex= thd->lex; Lex_input_stream *lip= thd->m_lip; - lex->sphead->reset_lex(thd); + if (lex->sphead->reset_lex(thd)) + MYSQL_YYABORT; lex->sphead->m_tmp_query= lip->tok_start; } statement @@ -2255,9 +2269,10 @@ sp_proc_stmt: lex->var_list.is_empty()); if (lex->sql_command != SQLCOM_SET_OPTION) { - sp_instr_stmt *i=new sp_instr_stmt(sp->instructions(), + sp_instr_stmt *i= new sp_instr_stmt(sp->instructions(), lex->spcont, lex); - + if (i == NULL) + MYSQL_YYABORT; /* Extract the query statement from the tokenizer. The end is either lex->ptr, if there was no lookahead, @@ -2275,7 +2290,10 @@ sp_proc_stmt: sp->restore_lex(thd); } | RETURN_SYM - { Lex->sphead->reset_lex(YYTHD); } + { + if(Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; + } expr { LEX *lex= Lex; @@ -2292,6 +2310,8 @@ sp_proc_stmt: i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3, sp->m_return_field_def.sql_type, lex); + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); sp->m_flags|= sp_head::HAS_RETURN; } @@ -2334,12 +2354,23 @@ sp_proc_stmt: uint n; n= ctx->diff_handlers(lab->ctx, TRUE); /* Exclusive the dest. */ + if (n) - sp->add_instr(new sp_instr_hpop(ip++, ctx, n)); + { + sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n); + if (hpop == NULL) + MYSQL_YYABORT; + sp->add_instr(hpop); + } n= ctx->diff_cursors(lab->ctx, TRUE); /* Exclusive the dest. */ if (n) - sp->add_instr(new sp_instr_cpop(ip++, ctx, n)); + { + sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n); + sp->add_instr(cpop); + } i= new sp_instr_jump(ip, ctx); + if (i == NULL) + MYSQL_YYABORT; sp->push_backpatch(i, lab); /* Jumping forward */ sp->add_instr(i); } @@ -2364,11 +2395,19 @@ sp_proc_stmt: n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */ if (n) - sp->add_instr(new sp_instr_hpop(ip++, ctx, n)); + { + sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n); + sp->add_instr(hpop); + } n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */ if (n) - sp->add_instr(new sp_instr_cpop(ip++, ctx, n)); + { + sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n); + sp->add_instr(cpop); + } i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */ + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); } } @@ -2385,6 +2424,8 @@ sp_proc_stmt: MYSQL_YYABORT; } i= new sp_instr_copen(sp->instructions(), lex->spcont, offset); + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); } | FETCH_SYM sp_opt_fetch_noise ident INTO @@ -2400,6 +2441,8 @@ sp_proc_stmt: MYSQL_YYABORT; } i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); } sp_fetch_list @@ -2417,6 +2460,8 @@ sp_proc_stmt: MYSQL_YYABORT; } i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset); + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); } ; @@ -2472,7 +2517,10 @@ sp_fetch_list: ; sp_if: - { Lex->sphead->reset_lex(YYTHD); } + { + if (Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; + } expr THEN_SYM { LEX *lex= Lex; @@ -2481,7 +2529,8 @@ sp_if: uint ip= sp->instructions(); sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx, $2, lex); - + if (i == NULL) + MYSQL_YYABORT; sp->push_backpatch(i, ctx->push_label((char *)"", 0)); sp->add_cont_backpatch(i); sp->add_instr(i); @@ -2493,7 +2542,8 @@ sp_if: sp_pcontext *ctx= Lex->spcont; uint ip= sp->instructions(); sp_instr_jump *i = new sp_instr_jump(ip, ctx); - + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); sp->backpatch(ctx->pop_label()); sp->push_backpatch(i, ctx->push_label((char *)"", 0)); @@ -2522,7 +2572,8 @@ simple_case_stmt: { LEX *lex= Lex; case_stmt_action_case(lex); - lex->sphead->reset_lex(YYTHD); /* For expr $3 */ + if (lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; /* For expr $3 */ } expr { @@ -2571,7 +2622,8 @@ searched_when_clause_list: simple_when_clause: WHEN_SYM { - Lex->sphead->reset_lex(YYTHD); /* For expr $3 */ + if (Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; /* For expr $3 */ } expr { @@ -2592,7 +2644,8 @@ simple_when_clause: searched_when_clause: WHEN_SYM { - Lex->sphead->reset_lex(YYTHD); /* For expr $3 */ + if (Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; /* For expr $3 */ } expr { @@ -2616,6 +2669,8 @@ else_clause_opt: uint ip= sp->instructions(); sp_instr_error *i= new sp_instr_error(ip, lex->spcont, ER_SP_CASE_NOT_FOUND); + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); } | ELSE sp_proc_stmts1 @@ -2685,11 +2740,21 @@ sp_unlabeled_control: sp->backpatch(ctx->last_label()); /* We always have a label */ if ($3.hndlrs) - sp->add_instr(new sp_instr_hpop(sp->instructions(), ctx, - $3.hndlrs)); + { + sp_instr_hpop *hpop= new sp_instr_hpop(sp->instructions(), ctx, + $3.hndlrs); + if (hpop == NULL) + MYSQL_YYABORT; + sp->add_instr(hpop); + } if ($3.curs) - sp->add_instr(new sp_instr_cpop(sp->instructions(), ctx, - $3.curs)); + { + sp_instr_cpop *cpop= new sp_instr_cpop(sp->instructions(), ctx, + $3.curs); + if (cpop == NULL) + MYSQL_YYABORT; + sp->add_instr(cpop); + } lex->spcont= ctx->pop_context(); } | LOOP_SYM @@ -2699,11 +2764,15 @@ sp_unlabeled_control: uint ip= lex->sphead->instructions(); sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */ sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip); - + if (i == NULL) + MYSQL_YYABORT; lex->sphead->add_instr(i); } | WHILE_SYM - { Lex->sphead->reset_lex(YYTHD); } + { + if (Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; + } expr DO_SYM { LEX *lex= Lex; @@ -2711,7 +2780,8 @@ sp_unlabeled_control: uint ip= sp->instructions(); sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont, $3, lex); - + if (i == NULL) + MYSQL_YYABORT; /* Jumping forward */ sp->push_backpatch(i, lex->spcont->last_label()); sp->new_cont_backpatch(i); @@ -2724,12 +2794,16 @@ sp_unlabeled_control: uint ip= lex->sphead->instructions(); sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */ sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip); - + if (i == NULL) + MYSQL_YYABORT; lex->sphead->add_instr(i); lex->sphead->do_cont_backpatch(); } | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM - { Lex->sphead->reset_lex(YYTHD); } + { + if (Lex->sphead->reset_lex(YYTHD)) + MYSQL_YYABORT; + } expr END REPEAT_SYM { LEX *lex= Lex; @@ -2738,6 +2812,8 @@ sp_unlabeled_control: sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont, $5, lab->ip, lex); + if (i == NULL) + MYSQL_YYABORT; lex->sphead->add_instr(i); lex->sphead->restore_lex(YYTHD); /* We can shortcut the cont_backpatch here */ @@ -4271,6 +4347,8 @@ select_init2: select_part2 { LEX *lex= Lex; + if (lex == NULL) + MYSQL_YYABORT; SELECT_LEX * sel= lex->current_select; if (lex->current_select->set_braces(0)) { @@ -4624,6 +4702,8 @@ predicate: $7->push_front($5); $7->push_front($1); Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7); + if (item == NULL) + MYSQL_YYABORT; item->negate(); $$= item; } @@ -5084,7 +5164,8 @@ simple_expr: { LEX *lex= Lex; sp_name *name= new sp_name($1, $3, true); - + if (name == NULL) + MYSQL_YYABORT; name->init_qname(YYTHD); sp_add_used_routine(lex, YYTHD, name, TYPE_ENUM_FUNCTION); if ($5) @@ -5199,8 +5280,9 @@ simple_expr: if (lex->copy_db_to(&db.str, &db.length)) MYSQL_YYABORT; sp_name *name= new sp_name(db, $1, false); - if (name) - name->init_qname(thd); + if (name == NULL) + MYSQL_YYABORT; + name->init_qname(thd); sp_add_used_routine(lex, YYTHD, name, TYPE_ENUM_FUNCTION); if ($4) @@ -8422,7 +8504,8 @@ option_type_value: QQ: May be we should simply prohibit group assignments in SP? */ - Lex->sphead->reset_lex(thd); + if (Lex->sphead->reset_lex(thd)) + MYSQL_YYABORT; lex= thd->lex; /* Set new LEX as if we at start of set rule. */ @@ -8587,6 +8670,8 @@ sys_option_value: it= spv->dflt; else it= new Item_null(); + if (it == NULL) + MYSQL_YYABORT; sp_set= new sp_instr_set(lex->sphead->instructions(), ctx, spv->offset, it, spv->type, lex, TRUE); lex->sphead->add_instr(sp_set); @@ -9832,6 +9917,8 @@ sp_tail: /* Order is important here: new - reset - init */ sp= new sp_head(); + if (sp == NULL) + MYSQL_YYABORT; sp->reset_thd_mem_root(YYTHD); sp->init(lex); sp->m_type= TYPE_ENUM_PROCEDURE; From 719e64e4a55a6893b14464cb28e8beaaa33f6a7c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Nov 2007 10:18:19 -0200 Subject: [PATCH 3/5] Bug#32528 Global read lock with a low priority write lock causes a server crash FLUSH TABLES WITH READ LOCK fails to properly detect write locked tables when running under low priority updates. The problem is that when trying to aspire a global read lock, the reload_acl_and_cache() function fails to properly check if the thread has a low priority write lock, which later my cause a server crash or deadlock. The solution is to simple check if the thread has any type of the possible exclusive write locks. mysql-test/r/flush.result: Add test case result for Bug#32528 mysql-test/t/flush.test: Add test case for Bug#32528 sql/sql_parse.cc: Although it should not matter under LOCK TABLES, use TL_WRITE_ALLOW_WRITE to emphasize that it should fail in case of any write lock. --- mysql-test/r/flush.result | 17 +++++++++++++++++ mysql-test/t/flush.test | 31 +++++++++++++++++++++++++++++++ sql/sql_parse.cc | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index 7eb7fd16edb..ce64e09c1d3 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -55,3 +55,20 @@ flush tables with read lock; insert into t2 values(1); unlock tables; drop table t1, t2; +drop table if exists t1, t2; +set session low_priority_updates=1; +create table t1 (a int); +create table t2 (b int); +lock tables t1 write; +flush tables with read lock; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +unlock tables; +lock tables t1 read, t2 write; +flush tables with read lock; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +unlock tables; +lock tables t1 read; +flush tables with read lock; +unlock tables; +drop table t1, t2; +set session low_priority_updates=default; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 3a4f2f2f5f2..72efa8a2ee6 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -133,4 +133,35 @@ disconnect con3; connection default; drop table t1, t2; +# +# Bug#32528 Global read lock with a low priority write lock causes a server crash +# + +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +set session low_priority_updates=1; + +create table t1 (a int); +create table t2 (b int); + +lock tables t1 write; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +flush tables with read lock; +unlock tables; + +lock tables t1 read, t2 write; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +flush tables with read lock; +unlock tables; + +lock tables t1 read; +flush tables with read lock; +unlock tables; + +drop table t1, t2; + +set session low_priority_updates=default; + # End of 5.0 tests diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0a8b92d28c0..e587a9f3561 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7054,7 +7054,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, for (; lock_p < end_p; lock_p++) { - if ((*lock_p)->type == TL_WRITE) + if ((*lock_p)->type >= TL_WRITE_ALLOW_WRITE) { my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); return 1; From fea1524dbfb413820ba3594064da658c22417671 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Nov 2007 15:44:05 +0100 Subject: [PATCH 4/5] Bug #32436 KILL QUERY completely deadlocks mysqld Sending several "KILL QUERY" statements to target a connection running "SELECT SLEEP" could freeze the server. The locking order in Item_func_sleep was wrong and this could lead to a dead lock. This patch solves the issue by resolving the locking order properly. sql/item_func.cc: - Moved LOCK_user_locks critical region so that it doesn't share space with mysys_var->mutex region; this can lead to deadlock. --- sql/item_func.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index d03d497dfd0..a0824f2a146 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3732,13 +3732,12 @@ longlong Item_func_sleep::val_int() break; error= 0; } - + pthread_mutex_unlock(&LOCK_user_locks); pthread_mutex_lock(&thd->mysys_var->mutex); thd->mysys_var->current_mutex= 0; thd->mysys_var->current_cond= 0; pthread_mutex_unlock(&thd->mysys_var->mutex); - pthread_mutex_unlock(&LOCK_user_locks); pthread_cond_destroy(&cond); return test(!error); // Return 1 killed From b8a19c228ce93ff5e57d7d122d8d5a74236670f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Nov 2007 14:09:37 -0200 Subject: [PATCH 5/5] Bug#29592 SQL Injection issue Remove the mysql_odbc_escape_string() function. The function has multi-byte character escaping issues, doesn't honor the NO_BACKSLASH_ESCAPES mode and is not used anymore by the Connector/ODBC as of 3.51.17. include/mysql.h: Remove mysql_odbc_escape_string() prototype. include/mysql_h.ic: Update abi check file, mostly line changes and mysql_odbc_escape_string removal. libmysql/libmysql.c: Remove mysql_odbc_escape_string() body. libmysql/libmysql.def: Remove mysql_odbc_escape_string() libmysqld/libmysqld.def: Remove mysql_odbc_escape_string() --- include/mysql.h | 10 - include/mysql_h.ic | 816 ++++++++++++++++++++-------------------- libmysql/libmysql.c | 72 ---- libmysql/libmysql.def | 1 - libmysqld/libmysqld.def | 1 - 5 files changed, 407 insertions(+), 493 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index b3e0dc45496..f2303abb241 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -550,16 +550,6 @@ unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, unsigned long length); void STDCALL mysql_debug(const char *debug); -char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, - char *to, - unsigned long to_length, - const char *from, - unsigned long from_length, - void *param, - char * - (*extend_buffer) - (void *, char *to, - unsigned long *length)); void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); unsigned int STDCALL mysql_thread_safe(void); my_bool STDCALL mysql_embedded(void); diff --git a/include/mysql_h.ic b/include/mysql_h.ic index 5a9daee6f9f..1d4f3ce2758 100644 --- a/include/mysql_h.ic +++ b/include/mysql_h.ic @@ -32,65 +32,65 @@ enum mysql_option; enum mysql_protocol_type; enum mysql_rpl_type; enum mysql_status; -# 134 "mysql.h" +# 138 "mysql.h" typedef struct st_mysql_rows MYSQL_ROWS; -# 24 "my_list.h" +# 23 "my_list.h" typedef struct st_list LIST; -# 35 "my_alloc.h" +# 34 "my_alloc.h" typedef struct st_mem_root MEM_ROOT; -# 251 "mysql.h" +# 255 "mysql.h" typedef struct st_mysql MYSQL; -# 653 "mysql.h" +# 647 "mysql.h" typedef struct st_mysql_bind MYSQL_BIND; -# 93 "mysql.h" +# 97 "mysql.h" typedef struct st_mysql_field MYSQL_FIELD; -# 117 "mysql.h" +# 121 "mysql.h" typedef unsigned int MYSQL_FIELD_OFFSET; -# 340 "mysql.h" +# 344 "mysql.h" typedef struct st_mysql_manager MYSQL_MANAGER; -# 354 "mysql.h" +# 358 "mysql.h" typedef struct st_mysql_parameters MYSQL_PARAMETERS; -# 309 "mysql.h" +# 313 "mysql.h" typedef struct st_mysql_res MYSQL_RES; -# 116 "mysql.h" +# 120 "mysql.h" typedef char * * MYSQL_ROW; -# 140 "mysql.h" -typedef MYSQL_ROWS * MYSQL_ROW_OFFSET; -# 681 "mysql.h" -typedef struct st_mysql_stmt MYSQL_STMT; -# 236 "mysql.h" -typedef struct character_set MY_CHARSET_INFO; -# 180 "mysql_com.h" -typedef struct st_net NET; -# 23 "typelib.h" -typedef struct st_typelib TYPELIB; -# 170 "mysql_com.h" -typedef struct st_vio Vio; -# 57 "mysql.h" -typedef char * gptr; -# 29 "my_list.h" -typedef int (* list_walk_action)(void *, void *); -# 48 "mysql.h" -typedef char my_bool; -# 63 "mysql.h" -typedef int my_socket; -# 125 "mysql.h" -typedef unsigned long long int my_ulonglong; # 144 "mysql.h" +typedef MYSQL_ROWS * MYSQL_ROW_OFFSET; +# 675 "mysql.h" +typedef struct st_mysql_stmt MYSQL_STMT; +# 240 "mysql.h" +typedef struct character_set MY_CHARSET_INFO; +# 179 "mysql_com.h" +typedef struct st_net NET; +# 22 "typelib.h" +typedef struct st_typelib TYPELIB; +# 169 "mysql_com.h" +typedef struct st_vio Vio; +# 60 "mysql.h" +typedef char * gptr; +# 28 "my_list.h" +typedef int (* list_walk_action)(void *, void *); +# 51 "mysql.h" +typedef char my_bool; +# 66 "mysql.h" +typedef int my_socket; +# 129 "mysql.h" +typedef unsigned long long int my_ulonglong; +# 148 "mysql.h" typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; -# 145 "mysql.h" +# 149 "mysql.h" typedef struct st_mysql_data MYSQL_DATA; -# 750 "mysql.h" +# 744 "mysql.h" typedef struct st_mysql_methods MYSQL_METHODS; -# 48 "mysql_time.h" +# 47 "mysql_time.h" typedef struct st_mysql_time MYSQL_TIME; -# 371 "mysql_com.h" +# 375 "mysql_com.h" typedef struct st_udf_args UDF_ARGS; -# 384 "mysql_com.h" +# 388 "mysql_com.h" typedef struct st_udf_init UDF_INIT; -# 27 "my_alloc.h" +# 26 "my_alloc.h" typedef struct st_used_mem USED_MEM; -# 236 "mysql.h" +# 240 "mysql.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) character_set { unsigned int number; @@ -102,7 +102,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo unsigned int mbminlen; unsigned int mbmaxlen; }; -# 357 "mysql_com.h" +# 361 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct { unsigned long int seed1; @@ -110,14 +110,14 @@ struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof unsigned long int max_value; double max_value_dbl; }; -# 24 "my_list.h" +# 23 "my_list.h" struct __attribute__((aligned(__alignof__(void *)))) st_list { struct st_list * prev; struct st_list * next; void * data; }; -# 35 "my_alloc.h" +# 34 "my_alloc.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_mem_root { USED_MEM * free; @@ -129,7 +129,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned unsigned int first_block_usage; void (* error_handler)(void); }; -# 251 "mysql.h" +# 255 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql { NET net; @@ -173,7 +173,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned void * thd; my_bool * unbuffered_fetch_owner; }; -# 653 "mysql.h" +# 647 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_bind { unsigned long int * length; @@ -195,7 +195,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned void (* fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char * * row); void (* skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char * * row); }; -# 145 "mysql.h" +# 149 "mysql.h" struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_data { my_ulonglong rows; @@ -204,7 +204,7 @@ struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__al MEM_ROOT alloc; struct embedded_query_result * embedded_info; }; -# 93 "mysql.h" +# 97 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_field { char * name; @@ -228,7 +228,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned unsigned int charsetnr; enum enum_field_types type; }; -# 340 "mysql.h" +# 344 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_manager { NET net; @@ -246,7 +246,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int net_buf_size; char last_error[256]; }; -# 750 "mysql.h" +# 744 "mysql.h" struct __attribute__((aligned(__alignof__(void *)))) st_mysql_methods { my_bool (* read_query_result)(MYSQL * mysql); @@ -266,7 +266,7 @@ struct __attribute__((aligned(__alignof__(void *)))) st_mysql_methods int (* read_change_user_result)(MYSQL * mysql, char * buff, char const * passwd); int (* read_rows_from_cursor)(MYSQL_STMT * stmt); }; -# 167 "mysql.h" +# 171 "mysql.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_mysql_options { unsigned int connect_timeout; @@ -309,13 +309,13 @@ struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof int (* local_infile_error)(void *, char *, unsigned int); void * local_infile_userdata; }; -# 354 "mysql.h" +# 358 "mysql.h" struct __attribute__((aligned(__alignof__(void *)))) st_mysql_parameters { unsigned long int * p_max_allowed_packet; unsigned long int * p_net_buffer_length; }; -# 309 "mysql.h" +# 313 "mysql.h" struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_res { my_ulonglong row_count; @@ -333,14 +333,14 @@ struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__al my_bool unbuffered_fetch_cancelled; struct st_mysql_methods const * methods; }; -# 134 "mysql.h" +# 138 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_rows { struct st_mysql_rows * next; MYSQL_ROW data; unsigned long int length; }; -# 681 "mysql.h" +# 675 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql_stmt { MEM_ROOT mem_root; @@ -370,7 +370,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned my_bool unbuffered_fetch_cancelled; my_bool update_max_length; }; -# 48 "mysql_time.h" +# 47 "mysql_time.h" struct __attribute__((aligned(__alignof__(unsigned long int)))) st_mysql_time { unsigned int year; @@ -383,7 +383,7 @@ struct __attribute__((aligned(__alignof__(unsigned long int)))) st_mysql_time my_bool neg; enum enum_mysql_timestamp_type time_type; }; -# 180 "mysql_com.h" +# 179 "mysql_com.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_net { Vio * vio; @@ -419,7 +419,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned my_bool report_error; my_bool return_errno; }; -# 23 "typelib.h" +# 22 "typelib.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib { unsigned int count; @@ -427,7 +427,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo char const * * type_names; unsigned int * type_lengths; }; -# 371 "mysql_com.h" +# 375 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args { unsigned int arg_count; @@ -438,7 +438,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo char * * attributes; unsigned long int * attribute_lengths; }; -# 384 "mysql_com.h" +# 388 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init { my_bool maybe_null; @@ -447,14 +447,14 @@ struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof char * ptr; my_bool const_item; }; -# 27 "my_alloc.h" +# 26 "my_alloc.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_used_mem { struct st_used_mem * next; unsigned int left; unsigned int size; }; -# 368 "mysql_com.h" +# 372 "mysql_com.h" enum Item_result { STRING_RESULT = 0, @@ -463,7 +463,7 @@ enum Item_result ROW_RESULT = 3, DECIMAL_RESULT = 4, }; -# 314 "mysql_com.h" +# 313 "mysql_com.h" enum enum_cursor_type { CURSOR_TYPE_NO_CURSOR = 0, @@ -471,7 +471,7 @@ enum enum_cursor_type CURSOR_TYPE_FOR_UPDATE = 2, CURSOR_TYPE_SCROLLABLE = 4, }; -# 227 "mysql_com.h" +# 226 "mysql_com.h" enum enum_field_types { MYSQL_TYPE_DECIMAL = 0, @@ -502,13 +502,13 @@ enum enum_field_types MYSQL_TYPE_STRING = 254, MYSQL_TYPE_GEOMETRY = 255, }; -# 324 "mysql_com.h" +# 323 "mysql_com.h" enum enum_mysql_set_option { MYSQL_OPTION_MULTI_STATEMENTS_ON = 0, MYSQL_OPTION_MULTI_STATEMENTS_OFF = 1, }; -# 583 "mysql.h" +# 577 "mysql.h" enum enum_mysql_stmt_state { MYSQL_STMT_INIT_DONE = 1, @@ -516,7 +516,7 @@ enum enum_mysql_stmt_state MYSQL_STMT_EXECUTE_DONE = 3, MYSQL_STMT_FETCH_DONE = 4, }; -# 29 "mysql_time.h" +# 28 "mysql_time.h" enum enum_mysql_timestamp_type { MYSQL_TIMESTAMP_NONE = -(2), @@ -525,7 +525,7 @@ enum enum_mysql_timestamp_type MYSQL_TIMESTAMP_DATETIME = 1, MYSQL_TIMESTAMP_TIME = 2, }; -# 52 "mysql_com.h" +# 51 "mysql_com.h" enum enum_server_command { COM_SLEEP = 0, @@ -559,14 +559,14 @@ enum enum_server_command COM_STMT_FETCH = 28, COM_END = 29, }; -# 727 "mysql.h" +# 721 "mysql.h" enum enum_stmt_attr_type { STMT_ATTR_UPDATE_MAX_LENGTH = 0, STMT_ATTR_CURSOR_TYPE = 1, STMT_ATTR_PREFETCH_ROWS = 2, }; -# 289 "mysql_com.h" +# 288 "mysql_com.h" enum mysql_enum_shutdown_level { SHUTDOWN_DEFAULT = 0, @@ -578,7 +578,7 @@ enum mysql_enum_shutdown_level KILL_QUERY = 254, KILL_CONNECTION = 255, }; -# 154 "mysql.h" +# 158 "mysql.h" enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT = 0, @@ -604,7 +604,7 @@ enum mysql_option MYSQL_OPT_RECONNECT = 20, MYSQL_OPT_SSL_VERIFY_SERVER_CERT = 21, }; -# 221 "mysql.h" +# 225 "mysql.h" enum mysql_protocol_type { MYSQL_PROTOCOL_DEFAULT = 0, @@ -613,357 +613,355 @@ enum mysql_protocol_type MYSQL_PROTOCOL_PIPE = 3, MYSQL_PROTOCOL_MEMORY = 4, }; -# 231 "mysql.h" +# 235 "mysql.h" enum mysql_rpl_type { MYSQL_RPL_MASTER = 0, MYSQL_RPL_SLAVE = 1, MYSQL_RPL_ADMIN = 2, }; -# 216 "mysql.h" +# 220 "mysql.h" enum mysql_status { MYSQL_STATUS_READY = 0, MYSQL_STATUS_GET_RESULT = 1, MYSQL_STATUS_USE_RESULT = 2, }; -# 423 "mysql_com.h" -extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); -# 416 "mysql_com.h" -extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); -# 33 "typelib.h" -extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from); -# 411 "mysql_com.h" -extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); -# 30 "typelib.h" -extern int find_type(char * x, TYPELIB * typelib, unsigned int); -# 425 "mysql_com.h" -extern void get_salt_from_password(unsigned char * res, char const * password); -# 418 "mysql_com.h" -extern void get_salt_from_password_323(unsigned long int * res, char const * password); -# 431 "mysql_com.h" -extern char * get_tty_password(char * opt_message); -# 32 "typelib.h" -extern char const * get_type(TYPELIB * typelib, unsigned int); -# 413 "mysql_com.h" -extern void hash_password(unsigned long int * to, char const * password, unsigned int); -# 31 "my_list.h" -extern LIST * list_add(LIST * root, LIST * element); -# 33 "my_list.h" -extern LIST * list_cons(void * data, LIST * root); -# 32 "my_list.h" -extern LIST * list_delete(LIST * root, LIST * element); -# 35 "my_list.h" -extern void list_free(LIST * root, unsigned int); -# 36 "my_list.h" -extern unsigned int list_length(LIST *); -# 34 "my_list.h" -extern LIST * list_reverse(LIST * root); -# 37 "my_list.h" -extern int list_walk(LIST *, list_walk_action, gptr); -# 440 "mysql_com.h" -extern int load_defaults(char const * conf_file, char const * * groups, int * argc, char * * * argv); -# 426 "mysql_com.h" -extern void make_password_from_salt(char * to, unsigned char const * hash_stage2); -# 419 "mysql_com.h" -extern void make_password_from_salt_323(char * to, unsigned long int const * salt); -# 421 "mysql_com.h" -extern void make_scrambled_password(char * to, char const * password); -# 414 "mysql_com.h" -extern void make_scrambled_password_323(char * to, char const * password); -# 31 "typelib.h" -extern void make_type(char * to, unsigned int, TYPELIB * typelib); -# 437 "mysql_com.h" -extern int modify_defaults_file(char const * file_location, char const * option, char const * option_value, char const * section_name, int); -# 354 "mysql_com.h" -extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int); -# 436 "mysql_com.h" -extern my_bool my_init(void); -# 336 "mysql_com.h" -extern my_bool my_net_init(NET * net, Vio * vio); -# 337 "mysql_com.h" -extern void my_net_local_init(NET * net); -# 347 "mysql_com.h" -extern unsigned long int my_net_read(NET * net); -# 342 "mysql_com.h" -extern my_bool my_net_write(NET * net, char const * packet, unsigned long int); -# 410 "mysql_com.h" -extern double my_rnd(struct rand_struct *); -# 443 "mysql_com.h" -extern void my_thread_end(void); -# 442 "mysql_com.h" -extern my_bool my_thread_init(void); -# 559 "mysql.h" -extern void myodbc_remove_escape(MYSQL * mysql, char * name); -# 501 "mysql.h" -extern int mysql_add_slave(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd); -# 410 "mysql.h" -extern my_ulonglong mysql_affected_rows(MYSQL * mysql); -# 823 "mysql.h" -extern my_bool mysql_autocommit(MYSQL * mysql, my_bool); -# 426 "mysql.h" -extern my_bool mysql_change_user(MYSQL * mysql, char const * user, char const * passwd, char const * db); -# 418 "mysql.h" -extern char const * mysql_character_set_name(MYSQL * mysql); -# 826 "mysql.h" -extern void mysql_close(MYSQL * sock); -# 821 "mysql.h" -extern my_bool mysql_commit(MYSQL * mysql); -# 530 "mysql.h" -extern void mysql_data_seek(MYSQL_RES * result, my_ulonglong); -# 548 "mysql.h" -extern void mysql_debug(char const * debug); -# 487 "mysql.h" -extern void mysql_disable_reads_from_master(MYSQL * mysql); -# 481 "mysql.h" -extern void mysql_disable_rpl_parse(MYSQL * mysql); -# 509 "mysql.h" -extern int mysql_dump_debug_info(MYSQL * mysql); -# 561 "mysql.h" -extern my_bool mysql_embedded(void); -# 486 "mysql.h" -extern void mysql_enable_reads_from_master(MYSQL * mysql); -# 480 "mysql.h" -extern void mysql_enable_rpl_parse(MYSQL * mysql); -# 402 "mysql.h" -extern my_bool mysql_eof(MYSQL_RES * res); -# 412 "mysql.h" -extern unsigned int mysql_errno(MYSQL * mysql); -# 432 "mysql_com.h" -extern char const * mysql_errno_to_sqlstate(unsigned int); -# 413 "mysql.h" -extern char const * mysql_error(MYSQL * mysql); -# 541 "mysql.h" -extern unsigned long int mysql_escape_string(char * to, char const * from, unsigned long int); -# 538 "mysql.h" -extern MYSQL_FIELD * mysql_fetch_field(MYSQL_RES * result); -# 403 "mysql.h" -extern MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES * res, unsigned int); -# 405 "mysql.h" -extern MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES * res); -# 537 "mysql.h" -extern unsigned long int * mysql_fetch_lengths(MYSQL_RES * result); -# 536 "mysql.h" -extern MYSQL_ROW mysql_fetch_row(MYSQL_RES * result); -# 409 "mysql.h" -extern unsigned int mysql_field_count(MYSQL * mysql); -# 534 "mysql.h" -extern MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES * result, MYSQL_FIELD_OFFSET); -# 407 "mysql.h" -extern MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES * res); -# 529 "mysql.h" -extern void mysql_free_result(MYSQL_RES * result); -# 454 "mysql.h" -extern void mysql_get_character_set_info(MYSQL * mysql, MY_CHARSET_INFO * charset); -# 519 "mysql.h" -extern char const * mysql_get_client_info(void); -# 520 "mysql.h" -extern unsigned long int mysql_get_client_version(void); -# 521 "mysql.h" -extern char const * mysql_get_host_info(MYSQL * mysql); -# 384 "mysql.h" -extern MYSQL_PARAMETERS * mysql_get_parameters(void); -# 523 "mysql.h" -extern unsigned int mysql_get_proto_info(MYSQL * mysql); -# 518 "mysql.h" -extern char const * mysql_get_server_info(MYSQL * mysql); -# 522 "mysql.h" -extern unsigned long int mysql_get_server_version(MYSQL * mysql); -# 425 "mysql.h" -extern char const * mysql_get_ssl_cipher(MYSQL * mysql); -# 543 "mysql.h" -extern unsigned long int mysql_hex_string(char * to, char const * from, unsigned long int); -# 416 "mysql.h" -extern char const * mysql_info(MYSQL * mysql); -# 421 "mysql.h" -extern MYSQL * mysql_init(MYSQL * mysql); -# 411 "mysql.h" -extern my_ulonglong mysql_insert_id(MYSQL * mysql); -# 512 "mysql.h" -extern int mysql_kill(MYSQL * mysql, unsigned long int); -# 524 "mysql.h" -extern MYSQL_RES * mysql_list_dbs(MYSQL * mysql, char const * wild); -# 539 "mysql.h" -extern MYSQL_RES * mysql_list_fields(MYSQL * mysql, char const * table, char const * wild); -# 526 "mysql.h" -extern MYSQL_RES * mysql_list_processes(MYSQL * mysql); -# 525 "mysql.h" -extern MYSQL_RES * mysql_list_tables(MYSQL * mysql, char const * wild); -# 568 "mysql.h" -extern void mysql_manager_close(MYSQL_MANAGER * con); -# 569 "mysql.h" -extern int mysql_manager_command(MYSQL_MANAGER * con, char const * cmd, int); -# 563 "mysql.h" -extern MYSQL_MANAGER * mysql_manager_connect(MYSQL_MANAGER * con, char const * host, char const * user, char const * passwd, unsigned int); -# 571 "mysql.h" -extern int mysql_manager_fetch_line(MYSQL_MANAGER * con, char * res_buf, int); -# 562 "mysql.h" -extern MYSQL_MANAGER * mysql_manager_init(MYSQL_MANAGER * con); -# 445 "mysql.h" -extern my_bool mysql_master_query(MYSQL * mysql, char const * q, unsigned long int); -# 447 "mysql.h" -extern my_bool mysql_master_send_query(MYSQL * mysql, char const * q, unsigned long int); -# 824 "mysql.h" -extern my_bool mysql_more_results(MYSQL * mysql); -# 825 "mysql.h" -extern int mysql_next_result(MYSQL * mysql); -# 401 "mysql.h" -extern unsigned int mysql_num_fields(MYSQL_RES * res); -# 400 "mysql.h" -extern my_ulonglong mysql_num_rows(MYSQL_RES * res); -# 549 "mysql.h" -extern char * mysql_odbc_escape_string(MYSQL * mysql, char * to, unsigned long int, char const * from, unsigned long int, void * param, char * (* extend_buffer)(void *, char * to, unsigned long int * length)); -# 527 "mysql.h" -extern int mysql_options(MYSQL * mysql, enum mysql_option, char const * arg); -# 516 "mysql.h" -extern int mysql_ping(MYSQL * mysql); -# 75 "mysql.h" -extern unsigned int mysql_port; -# 436 "mysql.h" -extern int mysql_query(MYSQL * mysql, char const * q); -# 574 "mysql.h" -extern my_bool mysql_read_query_result(MYSQL * mysql); -# 489 "mysql.h" -extern my_bool mysql_reads_from_master_enabled(MYSQL * mysql); -# 428 "mysql.h" -extern MYSQL * mysql_real_connect(MYSQL * mysql, char const * host, char const * user, char const * passwd, char const * db, unsigned int, char const * unix_socket, unsigned long int); -# 545 "mysql.h" -extern unsigned long int mysql_real_escape_string(MYSQL * mysql, char * to, char const * from, unsigned long int); -# 439 "mysql.h" -extern int mysql_real_query(MYSQL * mysql, char const * q, unsigned long int); -# 510 "mysql.h" -extern int mysql_refresh(MYSQL * mysql, unsigned int); -# 822 "mysql.h" -extern my_bool mysql_rollback(MYSQL * mysql); -# 532 "mysql.h" -extern MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES * result, MYSQL_ROW_OFFSET); -# 406 "mysql.h" -extern MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES * res); -# 483 "mysql.h" -extern int mysql_rpl_parse_enabled(MYSQL * mysql); -# 494 "mysql.h" -extern my_bool mysql_rpl_probe(MYSQL * mysql); -# 491 "mysql.h" -extern enum mysql_rpl_type mysql_rpl_query_type(char const * q, int); -# 435 "mysql.h" -extern int mysql_select_db(MYSQL * mysql, char const * db); -# 437 "mysql.h" -extern int mysql_send_query(MYSQL * mysql, char const * q, unsigned long int); -# 371 "mysql.h" -extern void mysql_server_end(void); -# 370 "mysql.h" -extern int mysql_server_init(int, char * * argv, char * * groups); -# 419 "mysql.h" -extern int mysql_set_character_set(MYSQL * mysql, char const * csname); -# 472 "mysql.h" -extern void mysql_set_local_infile_default(MYSQL * mysql); -# 461 "mysql.h" -extern void mysql_set_local_infile_handler(MYSQL * mysql, int (* local_infile_init)(void * *, char const *, void *), int (* local_infile_read)(void *, char *, unsigned int), void (* local_infile_end)(void), int (* local_infile_error)(void *, char *, unsigned int), void *); -# 497 "mysql.h" -extern int mysql_set_master(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd); -# 513 "mysql.h" -extern int mysql_set_server_option(MYSQL * mysql, enum enum_mysql_set_option); -# 506 "mysql.h" -extern int mysql_shutdown(MYSQL * mysql, enum mysql_enum_shutdown_level); -# 450 "mysql.h" -extern my_bool mysql_slave_query(MYSQL * mysql, char const * q, unsigned long int); -# 452 "mysql.h" -extern my_bool mysql_slave_send_query(MYSQL * mysql, char const * q, unsigned long int); -# 414 "mysql.h" -extern char const * mysql_sqlstate(MYSQL * mysql); -# 422 "mysql.h" -extern my_bool mysql_ssl_set(MYSQL * mysql, char const * key, char const * cert, char const * ca, char const * capath, char const * cipher); -# 517 "mysql.h" -extern char const * mysql_stat(MYSQL * mysql); -# 817 "mysql.h" -extern my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT * stmt); -# 795 "mysql.h" -extern my_bool mysql_stmt_attr_get(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void * attr); -# 792 "mysql.h" -extern my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void const * attr); -# 798 "mysql.h" -extern my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -# 799 "mysql.h" -extern my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); -# 800 "mysql.h" -extern my_bool mysql_stmt_close(MYSQL_STMT * stmt); -# 815 "mysql.h" -extern void mysql_stmt_data_seek(MYSQL_STMT * stmt, my_ulonglong); -# 809 "mysql.h" -extern unsigned int mysql_stmt_errno(MYSQL_STMT * stmt); -# 810 "mysql.h" -extern char const * mysql_stmt_error(MYSQL_STMT * stmt); -# 785 "mysql.h" -extern int mysql_stmt_execute(MYSQL_STMT * stmt); -# 786 "mysql.h" -extern int mysql_stmt_fetch(MYSQL_STMT * stmt); -# 787 "mysql.h" -extern int mysql_stmt_fetch_column(MYSQL_STMT * stmt, MYSQL_BIND * bind, unsigned int, unsigned long int); -# 819 "mysql.h" -extern unsigned int mysql_stmt_field_count(MYSQL_STMT * stmt); -# 802 "mysql.h" -extern my_bool mysql_stmt_free_result(MYSQL_STMT * stmt); -# 782 "mysql.h" -extern MYSQL_STMT * mysql_stmt_init(MYSQL * mysql); -# 818 "mysql.h" -extern my_ulonglong mysql_stmt_insert_id(MYSQL_STMT * stmt); -# 816 "mysql.h" -extern my_ulonglong mysql_stmt_num_rows(MYSQL_STMT * stmt); -# 791 "mysql.h" -extern unsigned long int mysql_stmt_param_count(MYSQL_STMT * stmt); -# 808 "mysql.h" -extern MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT * stmt); -# 783 "mysql.h" -extern int mysql_stmt_prepare(MYSQL_STMT * stmt, char const * query, unsigned long int); -# 801 "mysql.h" -extern my_bool mysql_stmt_reset(MYSQL_STMT * stmt); -# 807 "mysql.h" -extern MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT * stmt); -# 812 "mysql.h" -extern MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT * stmt, MYSQL_ROW_OFFSET); -# 814 "mysql.h" -extern MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT * stmt); -# 803 "mysql.h" -extern my_bool mysql_stmt_send_long_data(MYSQL_STMT * stmt, unsigned int, char const * data, unsigned long int); -# 811 "mysql.h" -extern char const * mysql_stmt_sqlstate(MYSQL_STMT * stmt); -# 790 "mysql.h" -extern int mysql_stmt_store_result(MYSQL_STMT * stmt); -# 441 "mysql.h" -extern MYSQL_RES * mysql_store_result(MYSQL * mysql); -# 393 "mysql.h" -extern void mysql_thread_end(void); -# 417 "mysql.h" -extern unsigned long int mysql_thread_id(MYSQL * mysql); -# 392 "mysql.h" -extern my_bool mysql_thread_init(void); -# 560 "mysql.h" -extern unsigned int mysql_thread_safe(void); -# 76 "mysql.h" -extern char * mysql_unix_port; -# 442 "mysql.h" -extern MYSQL_RES * mysql_use_result(MYSQL * mysql); -# 415 "mysql.h" -extern unsigned int mysql_warning_count(MYSQL * mysql); -# 339 "mysql_com.h" -extern void net_clear(NET * net); -# 338 "mysql_com.h" -extern void net_end(NET * net); -# 341 "mysql_com.h" -extern my_bool net_flush(NET * net); -# 346 "mysql_com.h" -extern int net_real_write(NET * net, char const * packet, unsigned long int); -# 340 "mysql_com.h" -extern my_bool net_realloc(NET * net, unsigned long int); -# 343 "mysql_com.h" -extern my_bool net_write_command(NET * net, unsigned char, char const * header, unsigned long int, char const * packet, unsigned long int); # 427 "mysql_com.h" -extern char * octet2hex(char * to, char const * str, unsigned int); -# 408 "mysql_com.h" -extern void randominit(struct rand_struct *, unsigned long int, unsigned long int); -# 422 "mysql_com.h" -extern void scramble(char * to, char const * message, char const * password); +extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); +# 420 "mysql_com.h" +extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); +# 32 "typelib.h" +extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from); # 415 "mysql_com.h" +extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); +# 29 "typelib.h" +extern int find_type(char * x, TYPELIB * typelib, unsigned int); +# 429 "mysql_com.h" +extern void get_salt_from_password(unsigned char * res, char const * password); +# 422 "mysql_com.h" +extern void get_salt_from_password_323(unsigned long int * res, char const * password); +# 435 "mysql_com.h" +extern char * get_tty_password(char * opt_message); +# 31 "typelib.h" +extern char const * get_type(TYPELIB * typelib, unsigned int); +# 417 "mysql_com.h" +extern void hash_password(unsigned long int * to, char const * password, unsigned int); +# 30 "my_list.h" +extern LIST * list_add(LIST * root, LIST * element); +# 32 "my_list.h" +extern LIST * list_cons(void * data, LIST * root); +# 31 "my_list.h" +extern LIST * list_delete(LIST * root, LIST * element); +# 34 "my_list.h" +extern void list_free(LIST * root, unsigned int); +# 35 "my_list.h" +extern unsigned int list_length(LIST *); +# 33 "my_list.h" +extern LIST * list_reverse(LIST * root); +# 36 "my_list.h" +extern int list_walk(LIST *, list_walk_action, gptr); +# 444 "mysql_com.h" +extern int load_defaults(char const * conf_file, char const * * groups, int * argc, char * * * argv); +# 430 "mysql_com.h" +extern void make_password_from_salt(char * to, unsigned char const * hash_stage2); +# 423 "mysql_com.h" +extern void make_password_from_salt_323(char * to, unsigned long int const * salt); +# 425 "mysql_com.h" +extern void make_scrambled_password(char * to, char const * password); +# 418 "mysql_com.h" +extern void make_scrambled_password_323(char * to, char const * password); +# 30 "typelib.h" +extern void make_type(char * to, unsigned int, TYPELIB * typelib); +# 441 "mysql_com.h" +extern int modify_defaults_file(char const * file_location, char const * option, char const * option_value, char const * section_name, int); +# 358 "mysql_com.h" +extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int); +# 440 "mysql_com.h" +extern my_bool my_init(void); +# 335 "mysql_com.h" +extern my_bool my_net_init(NET * net, Vio * vio); +# 336 "mysql_com.h" +extern void my_net_local_init(NET * net); +# 346 "mysql_com.h" +extern unsigned long int my_net_read(NET * net); +# 341 "mysql_com.h" +extern my_bool my_net_write(NET * net, char const * packet, unsigned long int); +# 414 "mysql_com.h" +extern double my_rnd(struct rand_struct *); +# 447 "mysql_com.h" +extern void my_thread_end(void); +# 446 "mysql_com.h" +extern my_bool my_thread_init(void); +# 553 "mysql.h" +extern void myodbc_remove_escape(MYSQL * mysql, char * name); +# 505 "mysql.h" +extern int mysql_add_slave(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd); +# 414 "mysql.h" +extern my_ulonglong mysql_affected_rows(MYSQL * mysql); +# 817 "mysql.h" +extern my_bool mysql_autocommit(MYSQL * mysql, my_bool); +# 430 "mysql.h" +extern my_bool mysql_change_user(MYSQL * mysql, char const * user, char const * passwd, char const * db); +# 422 "mysql.h" +extern char const * mysql_character_set_name(MYSQL * mysql); +# 820 "mysql.h" +extern void mysql_close(MYSQL * sock); +# 815 "mysql.h" +extern my_bool mysql_commit(MYSQL * mysql); +# 534 "mysql.h" +extern void mysql_data_seek(MYSQL_RES * result, my_ulonglong); +# 552 "mysql.h" +extern void mysql_debug(char const * debug); +# 491 "mysql.h" +extern void mysql_disable_reads_from_master(MYSQL * mysql); +# 485 "mysql.h" +extern void mysql_disable_rpl_parse(MYSQL * mysql); +# 513 "mysql.h" +extern int mysql_dump_debug_info(MYSQL * mysql); +# 555 "mysql.h" +extern my_bool mysql_embedded(void); +# 490 "mysql.h" +extern void mysql_enable_reads_from_master(MYSQL * mysql); +# 484 "mysql.h" +extern void mysql_enable_rpl_parse(MYSQL * mysql); +# 406 "mysql.h" +extern my_bool mysql_eof(MYSQL_RES * res); +# 416 "mysql.h" +extern unsigned int mysql_errno(MYSQL * mysql); +# 436 "mysql_com.h" +extern char const * mysql_errno_to_sqlstate(unsigned int); +# 417 "mysql.h" +extern char const * mysql_error(MYSQL * mysql); +# 545 "mysql.h" +extern unsigned long int mysql_escape_string(char * to, char const * from, unsigned long int); +# 542 "mysql.h" +extern MYSQL_FIELD * mysql_fetch_field(MYSQL_RES * result); +# 407 "mysql.h" +extern MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES * res, unsigned int); +# 409 "mysql.h" +extern MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES * res); +# 541 "mysql.h" +extern unsigned long int * mysql_fetch_lengths(MYSQL_RES * result); +# 540 "mysql.h" +extern MYSQL_ROW mysql_fetch_row(MYSQL_RES * result); +# 413 "mysql.h" +extern unsigned int mysql_field_count(MYSQL * mysql); +# 538 "mysql.h" +extern MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES * result, MYSQL_FIELD_OFFSET); +# 411 "mysql.h" +extern MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES * res); +# 533 "mysql.h" +extern void mysql_free_result(MYSQL_RES * result); +# 458 "mysql.h" +extern void mysql_get_character_set_info(MYSQL * mysql, MY_CHARSET_INFO * charset); +# 523 "mysql.h" +extern char const * mysql_get_client_info(void); +# 524 "mysql.h" +extern unsigned long int mysql_get_client_version(void); +# 525 "mysql.h" +extern char const * mysql_get_host_info(MYSQL * mysql); +# 388 "mysql.h" +extern MYSQL_PARAMETERS * mysql_get_parameters(void); +# 527 "mysql.h" +extern unsigned int mysql_get_proto_info(MYSQL * mysql); +# 522 "mysql.h" +extern char const * mysql_get_server_info(MYSQL * mysql); +# 526 "mysql.h" +extern unsigned long int mysql_get_server_version(MYSQL * mysql); +# 429 "mysql.h" +extern char const * mysql_get_ssl_cipher(MYSQL * mysql); +# 547 "mysql.h" +extern unsigned long int mysql_hex_string(char * to, char const * from, unsigned long int); +# 420 "mysql.h" +extern char const * mysql_info(MYSQL * mysql); +# 425 "mysql.h" +extern MYSQL * mysql_init(MYSQL * mysql); +# 415 "mysql.h" +extern my_ulonglong mysql_insert_id(MYSQL * mysql); +# 516 "mysql.h" +extern int mysql_kill(MYSQL * mysql, unsigned long int); +# 528 "mysql.h" +extern MYSQL_RES * mysql_list_dbs(MYSQL * mysql, char const * wild); +# 543 "mysql.h" +extern MYSQL_RES * mysql_list_fields(MYSQL * mysql, char const * table, char const * wild); +# 530 "mysql.h" +extern MYSQL_RES * mysql_list_processes(MYSQL * mysql); +# 529 "mysql.h" +extern MYSQL_RES * mysql_list_tables(MYSQL * mysql, char const * wild); +# 562 "mysql.h" +extern void mysql_manager_close(MYSQL_MANAGER * con); +# 563 "mysql.h" +extern int mysql_manager_command(MYSQL_MANAGER * con, char const * cmd, int); +# 557 "mysql.h" +extern MYSQL_MANAGER * mysql_manager_connect(MYSQL_MANAGER * con, char const * host, char const * user, char const * passwd, unsigned int); +# 565 "mysql.h" +extern int mysql_manager_fetch_line(MYSQL_MANAGER * con, char * res_buf, int); +# 556 "mysql.h" +extern MYSQL_MANAGER * mysql_manager_init(MYSQL_MANAGER * con); +# 449 "mysql.h" +extern my_bool mysql_master_query(MYSQL * mysql, char const * q, unsigned long int); +# 451 "mysql.h" +extern my_bool mysql_master_send_query(MYSQL * mysql, char const * q, unsigned long int); +# 818 "mysql.h" +extern my_bool mysql_more_results(MYSQL * mysql); +# 819 "mysql.h" +extern int mysql_next_result(MYSQL * mysql); +# 405 "mysql.h" +extern unsigned int mysql_num_fields(MYSQL_RES * res); +# 404 "mysql.h" +extern my_ulonglong mysql_num_rows(MYSQL_RES * res); +# 531 "mysql.h" +extern int mysql_options(MYSQL * mysql, enum mysql_option, char const * arg); +# 520 "mysql.h" +extern int mysql_ping(MYSQL * mysql); +# 78 "mysql.h" +extern unsigned int mysql_port; +# 440 "mysql.h" +extern int mysql_query(MYSQL * mysql, char const * q); +# 568 "mysql.h" +extern my_bool mysql_read_query_result(MYSQL * mysql); +# 493 "mysql.h" +extern my_bool mysql_reads_from_master_enabled(MYSQL * mysql); +# 432 "mysql.h" +extern MYSQL * mysql_real_connect(MYSQL * mysql, char const * host, char const * user, char const * passwd, char const * db, unsigned int, char const * unix_socket, unsigned long int); +# 549 "mysql.h" +extern unsigned long int mysql_real_escape_string(MYSQL * mysql, char * to, char const * from, unsigned long int); +# 443 "mysql.h" +extern int mysql_real_query(MYSQL * mysql, char const * q, unsigned long int); +# 514 "mysql.h" +extern int mysql_refresh(MYSQL * mysql, unsigned int); +# 816 "mysql.h" +extern my_bool mysql_rollback(MYSQL * mysql); +# 536 "mysql.h" +extern MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES * result, MYSQL_ROW_OFFSET); +# 410 "mysql.h" +extern MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES * res); +# 487 "mysql.h" +extern int mysql_rpl_parse_enabled(MYSQL * mysql); +# 498 "mysql.h" +extern my_bool mysql_rpl_probe(MYSQL * mysql); +# 495 "mysql.h" +extern enum mysql_rpl_type mysql_rpl_query_type(char const * q, int); +# 439 "mysql.h" +extern int mysql_select_db(MYSQL * mysql, char const * db); +# 441 "mysql.h" +extern int mysql_send_query(MYSQL * mysql, char const * q, unsigned long int); +# 375 "mysql.h" +extern void mysql_server_end(void); +# 374 "mysql.h" +extern int mysql_server_init(int, char * * argv, char * * groups); +# 423 "mysql.h" +extern int mysql_set_character_set(MYSQL * mysql, char const * csname); +# 476 "mysql.h" +extern void mysql_set_local_infile_default(MYSQL * mysql); +# 465 "mysql.h" +extern void mysql_set_local_infile_handler(MYSQL * mysql, int (* local_infile_init)(void * *, char const *, void *), int (* local_infile_read)(void *, char *, unsigned int), void (* local_infile_end)(void), int (* local_infile_error)(void *, char *, unsigned int), void *); +# 501 "mysql.h" +extern int mysql_set_master(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd); +# 517 "mysql.h" +extern int mysql_set_server_option(MYSQL * mysql, enum enum_mysql_set_option); +# 510 "mysql.h" +extern int mysql_shutdown(MYSQL * mysql, enum mysql_enum_shutdown_level); +# 454 "mysql.h" +extern my_bool mysql_slave_query(MYSQL * mysql, char const * q, unsigned long int); +# 456 "mysql.h" +extern my_bool mysql_slave_send_query(MYSQL * mysql, char const * q, unsigned long int); +# 418 "mysql.h" +extern char const * mysql_sqlstate(MYSQL * mysql); +# 426 "mysql.h" +extern my_bool mysql_ssl_set(MYSQL * mysql, char const * key, char const * cert, char const * ca, char const * capath, char const * cipher); +# 521 "mysql.h" +extern char const * mysql_stat(MYSQL * mysql); +# 811 "mysql.h" +extern my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT * stmt); +# 789 "mysql.h" +extern my_bool mysql_stmt_attr_get(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void * attr); +# 786 "mysql.h" +extern my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void const * attr); +# 792 "mysql.h" +extern my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); +# 793 "mysql.h" +extern my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); +# 794 "mysql.h" +extern my_bool mysql_stmt_close(MYSQL_STMT * stmt); +# 809 "mysql.h" +extern void mysql_stmt_data_seek(MYSQL_STMT * stmt, my_ulonglong); +# 803 "mysql.h" +extern unsigned int mysql_stmt_errno(MYSQL_STMT * stmt); +# 804 "mysql.h" +extern char const * mysql_stmt_error(MYSQL_STMT * stmt); +# 779 "mysql.h" +extern int mysql_stmt_execute(MYSQL_STMT * stmt); +# 780 "mysql.h" +extern int mysql_stmt_fetch(MYSQL_STMT * stmt); +# 781 "mysql.h" +extern int mysql_stmt_fetch_column(MYSQL_STMT * stmt, MYSQL_BIND * bind_arg, unsigned int, unsigned long int); +# 813 "mysql.h" +extern unsigned int mysql_stmt_field_count(MYSQL_STMT * stmt); +# 796 "mysql.h" +extern my_bool mysql_stmt_free_result(MYSQL_STMT * stmt); +# 776 "mysql.h" +extern MYSQL_STMT * mysql_stmt_init(MYSQL * mysql); +# 812 "mysql.h" +extern my_ulonglong mysql_stmt_insert_id(MYSQL_STMT * stmt); +# 810 "mysql.h" +extern my_ulonglong mysql_stmt_num_rows(MYSQL_STMT * stmt); +# 785 "mysql.h" +extern unsigned long int mysql_stmt_param_count(MYSQL_STMT * stmt); +# 802 "mysql.h" +extern MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT * stmt); +# 777 "mysql.h" +extern int mysql_stmt_prepare(MYSQL_STMT * stmt, char const * query, unsigned long int); +# 795 "mysql.h" +extern my_bool mysql_stmt_reset(MYSQL_STMT * stmt); +# 801 "mysql.h" +extern MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT * stmt); +# 806 "mysql.h" +extern MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT * stmt, MYSQL_ROW_OFFSET); +# 808 "mysql.h" +extern MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT * stmt); +# 797 "mysql.h" +extern my_bool mysql_stmt_send_long_data(MYSQL_STMT * stmt, unsigned int, char const * data, unsigned long int); +# 805 "mysql.h" +extern char const * mysql_stmt_sqlstate(MYSQL_STMT * stmt); +# 784 "mysql.h" +extern int mysql_stmt_store_result(MYSQL_STMT * stmt); +# 445 "mysql.h" +extern MYSQL_RES * mysql_store_result(MYSQL * mysql); +# 397 "mysql.h" +extern void mysql_thread_end(void); +# 421 "mysql.h" +extern unsigned long int mysql_thread_id(MYSQL * mysql); +# 396 "mysql.h" +extern my_bool mysql_thread_init(void); +# 554 "mysql.h" +extern unsigned int mysql_thread_safe(void); +# 79 "mysql.h" +extern char * mysql_unix_port; +# 446 "mysql.h" +extern MYSQL_RES * mysql_use_result(MYSQL * mysql); +# 419 "mysql.h" +extern unsigned int mysql_warning_count(MYSQL * mysql); +# 338 "mysql_com.h" +extern void net_clear(NET * net); +# 337 "mysql_com.h" +extern void net_end(NET * net); +# 340 "mysql_com.h" +extern my_bool net_flush(NET * net); +# 345 "mysql_com.h" +extern int net_real_write(NET * net, char const * packet, unsigned long int); +# 339 "mysql_com.h" +extern my_bool net_realloc(NET * net, unsigned long int); +# 342 "mysql_com.h" +extern my_bool net_write_command(NET * net, unsigned char, char const * header, unsigned long int, char const * packet, unsigned long int); +# 431 "mysql_com.h" +extern char * octet2hex(char * to, char const * str, unsigned int); +# 412 "mysql_com.h" +extern void randominit(struct rand_struct *, unsigned long int, unsigned long int); +# 426 "mysql_com.h" +extern void scramble(char * to, char const * message, char const * password); +# 419 "mysql_com.h" extern void scramble_323(char * to, char const * message, char const * password); -# 35 "typelib.h" +# 34 "typelib.h" extern TYPELIB sql_protocol_typelib; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 85509b49fdd..4afc3ec5925 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1617,78 +1617,6 @@ mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, return escape_string_for_mysql(mysql->charset, to, 0, from, length); } - -char * STDCALL -mysql_odbc_escape_string(MYSQL *mysql, - char *to, ulong to_length, - const char *from, ulong from_length, - void *param, - char * (*extend_buffer) - (void *, char *, ulong *)) -{ - char *to_end=to+to_length-5; - const char *end; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(mysql->charset); -#endif - - for (end=from+from_length; from != end ; from++) - { - if (to >= to_end) - { - to_length = (ulong) (end-from)+512; /* We want this much more */ - if (!(to=(*extend_buffer)(param, to, &to_length))) - return to; - to_end=to+to_length-5; - } -#ifdef USE_MB - { - int l; - if (use_mb_flag && (l = my_ismbchar(mysql->charset, from, end))) - { - while (l--) - *to++ = *from++; - from--; - continue; - } - } -#endif - switch (*from) { - case 0: /* Must be escaped for 'mysql' */ - *to++= '\\'; - *to++= '0'; - break; - case '\n': /* Must be escaped for logs */ - *to++= '\\'; - *to++= 'n'; - break; - case '\r': - *to++= '\\'; - *to++= 'r'; - break; - case '\\': - *to++= '\\'; - *to++= '\\'; - break; - case '\'': - *to++= '\\'; - *to++= '\''; - break; - case '"': /* Better safe than sorry */ - *to++= '\\'; - *to++= '"'; - break; - case '\032': /* This gives problems on Win32 */ - *to++= '\\'; - *to++= 'Z'; - break; - default: - *to++= *from; - } - } - return to; -} - void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name) { diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index 8c6b71d9553..81f86dc8726 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -78,7 +78,6 @@ EXPORTS mysql_next_result mysql_num_fields mysql_num_rows - mysql_odbc_escape_string mysql_options mysql_stmt_param_count mysql_stmt_param_metadata diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def index 8829112fefd..8aed164a30e 100644 --- a/libmysqld/libmysqld.def +++ b/libmysqld/libmysqld.def @@ -71,7 +71,6 @@ EXPORTS mysql_next_result mysql_num_fields mysql_num_rows - mysql_odbc_escape_string mysql_options mysql_ping mysql_query