Commit 7e063af3 authored by dkatz/Damien@damiendev's avatar dkatz/Damien@damiendev

Merge dkatz@bk-internal.mysql.com:/home/bk/mysql-5.1-maint

into  damiendev.:C:/build/mysql-5.1
parents f4ab12e8 ef3bbc42
...@@ -77,13 +77,13 @@ ...@@ -77,13 +77,13 @@
#define IGNORE_DATA 0x01 /* don't dump data for this table */ #define IGNORE_DATA 0x01 /* don't dump data for this table */
#define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */ #define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */
static char *add_load_option(char *ptr, const char *object, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *statement); const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, uint length, static ulong find_set(TYPELIB *lib, const char *x, uint length,
char **err_pos, uint *err_len); char **err_pos, uint *err_len);
static char *alloc_query_str(ulong size); static char *alloc_query_str(ulong size);
static char *field_escape(char *to,const char *from,uint length); static void field_escape(DYNAMIC_STRING* in, const char *from);
static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
quick= 1, extended_insert= 1, quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0, lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0,
...@@ -125,6 +125,19 @@ FILE *md_result_file= 0; ...@@ -125,6 +125,19 @@ FILE *md_result_file= 0;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
#endif #endif
static uint opt_protocol= 0; static uint opt_protocol= 0;
/*
Dynamic_string wrapper functions. In this file use these
wrappers, they will terminate the process if there is
an allocation failure.
*/
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
uint init_alloc, uint alloc_increment);
static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src);
static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str);
static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
uint length);
static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size);
/* /*
Constant for detection of default value of default_charset. Constant for detection of default value of default_charset.
If default_charset is equal to mysql_universal_client_charset, then If default_charset is equal to mysql_universal_client_charset, then
...@@ -436,7 +449,9 @@ static struct my_option my_long_options[] = ...@@ -436,7 +449,9 @@ static struct my_option my_long_options[] =
static const char *load_default_groups[]= { "mysqldump","client",0 }; static const char *load_default_groups[]= { "mysqldump","client",0 };
static void safe_exit(int error); static void maybe_exit(int error);
static void die(int error, const char* reason, ...);
static void maybe_die(int error, const char* reason, ...);
static void write_header(FILE *sql_file, char *db_name); static void write_header(FILE *sql_file, char *db_name);
static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
const char *prefix,const char *name, const char *prefix,const char *name,
...@@ -495,11 +510,7 @@ static void verbose_msg(const char *fmt, ...) ...@@ -495,11 +510,7 @@ static void verbose_msg(const char *fmt, ...)
void check_io(FILE *file) void check_io(FILE *file)
{ {
if (ferror(file)) if (ferror(file))
{ die(EX_EOF, "Got errno %d on write", errno);
fprintf(stderr, "%s: Got errno %d on write\n", my_progname, errno);
ignore_errors= 0; /* We can't ignore this error */
safe_exit(EX_EOF);
}
} }
static void print_version(void) static void print_version(void)
...@@ -887,12 +898,74 @@ static int get_options(int *argc, char ***argv) ...@@ -887,12 +898,74 @@ static int get_options(int *argc, char ***argv)
static void DB_error(MYSQL *mysql_arg, const char *when) static void DB_error(MYSQL *mysql_arg, const char *when)
{ {
DBUG_ENTER("DB_error"); DBUG_ENTER("DB_error");
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname, maybe_die(EX_MYSQLERR, "Got error: %d: %s %s",
mysql_errno(mysql_arg), mysql_error(mysql_arg), when); mysql_errno(mysql_arg), mysql_error(mysql_arg), when);
fflush(stderr);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} /* DB_error */ }
/*
Prints out an error message and kills the process.
SYNOPSIS
die()
error_num - process return value
fmt_reason - a format string for use by my_vsnprintf.
... - variable arguments for above fmt_reason string
DESCRIPTION
This call prints out the formatted error message to stderr and then
terminates the process.
*/
static void die(int error_num, const char* fmt_reason, ...)
{
char buffer[1000];
va_list args;
va_start(args,fmt_reason);
my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
va_end(args);
fprintf(stderr, "%s: %s\n", my_progname, buffer);
fflush(stderr);
ignore_errors= 0; /* force the exit */
maybe_exit(error_num);
}
/*
Prints out an error message and maybe kills the process.
SYNOPSIS
maybe_die()
error_num - process return value
fmt_reason - a format string for use by my_vsnprintf.
... - variable arguments for above fmt_reason string
DESCRIPTION
This call prints out the formatted error message to stderr and then
terminates the process, unless the --force command line option is used.
This call should be used for non-fatal errors (such as database
errors) that the code may still be able to continue to the next unit
of work.
*/
static void maybe_die(int error_num, const char* fmt_reason, ...)
{
char buffer[1000];
va_list args;
va_start(args,fmt_reason);
my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
va_end(args);
fprintf(stderr, "%s: %s\n", my_progname, buffer);
fflush(stderr);
maybe_exit(error_num);
}
/* /*
...@@ -917,10 +990,8 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, ...@@ -917,10 +990,8 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) || if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con)))) (res && !((*res)= mysql_store_result(mysql_con))))
{ {
fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n", maybe_die(EX_MYSQLERR, "Couldn't execute '%s': %s (%d)",
my_progname, query, query, mysql_error(mysql_con), mysql_errno(mysql_con));
mysql_error(mysql_con), mysql_errno(mysql_con));
safe_exit(EX_MYSQLERR);
return 1; return 1;
} }
return 0; return 0;
...@@ -965,7 +1036,7 @@ static void free_resources() ...@@ -965,7 +1036,7 @@ static void free_resources()
} }
static void safe_exit(int error) static void maybe_exit(int error)
{ {
if (!first_error) if (!first_error)
first_error= error; first_error= error;
...@@ -1025,10 +1096,7 @@ static int connect_to_db(char *host, char *user,char *passwd) ...@@ -1025,10 +1096,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */", my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str); compatible_mode_normal_str);
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1); DBUG_RETURN(1);
}
/* /*
set time_zone to UTC to allow dumping date types between servers with set time_zone to UTC to allow dumping date types between servers with
different time zone settings different time zone settings
...@@ -1037,10 +1105,7 @@ static int connect_to_db(char *host, char *user,char *passwd) ...@@ -1037,10 +1105,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
{ {
my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */"); my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */");
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1); DBUG_RETURN(1);
}
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} /* connect_to_db */ } /* connect_to_db */
...@@ -1061,10 +1126,8 @@ static void unescape(FILE *file,char *pos,uint length) ...@@ -1061,10 +1126,8 @@ static void unescape(FILE *file,char *pos,uint length)
char *tmp; char *tmp;
DBUG_ENTER("unescape"); DBUG_ENTER("unescape");
if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME)))) if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME))))
{ die(EX_MYSQLERR, "Couldn't allocate memory");
ignore_errors=0; /* Fatal error */
safe_exit(EX_MYSQLERR); /* Force exit */
}
mysql_real_escape_string(&mysql_connection, tmp, pos, length); mysql_real_escape_string(&mysql_connection, tmp, pos, length);
fputc('\'', file); fputc('\'', file);
fputs(tmp, file); fputs(tmp, file);
...@@ -1423,10 +1486,7 @@ static uint dump_events_for_db(char *db) ...@@ -1423,10 +1486,7 @@ static uint dump_events_for_db(char *db)
mysql_query(mysql, "LOCK TABLES mysql.event READ"); mysql_query(mysql, "LOCK TABLES mysql.event READ");
if (mysql_query_with_error_report(mysql, &event_list_res, "show events")) if (mysql_query_with_error_report(mysql, &event_list_res, "show events"))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
strcpy(delimiter, ";"); strcpy(delimiter, ";");
if (mysql_num_rows(event_list_res) > 0) if (mysql_num_rows(event_list_res) > 0)
...@@ -1701,11 +1761,10 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1701,11 +1761,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (!insert_pat_inited) if (!insert_pat_inited)
{ {
insert_pat_inited= 1; insert_pat_inited= 1;
if (init_dynamic_string(&insert_pat, "", 1024, 1024)) init_dynamic_string_checked(&insert_pat, "", 1024, 1024);
safe_exit(EX_MYSQLERR);
} }
else else
dynstr_set(&insert_pat, ""); dynstr_set_checked(&insert_pat, "");
} }
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " : insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
...@@ -1737,18 +1796,13 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1737,18 +1796,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_snprintf(buff, sizeof(buff), "show create table %s", result_table); my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
if (path) if (path)
{ {
if (!(sql_file= open_sql_file_for_table(table))) if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
write_header(sql_file, db); write_header(sql_file, db);
} }
if (!opt_xml && opt_comments) if (!opt_xml && opt_comments)
...@@ -1812,7 +1866,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1812,7 +1866,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else else
...@@ -1875,7 +1928,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1875,7 +1928,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{ {
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1888,21 +1940,21 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1888,21 +1940,21 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (write_data) if (write_data)
{ {
if (opt_replace_into) if (opt_replace_into)
dynstr_append_mem(&insert_pat, "REPLACE ", 8); dynstr_append_checked(&insert_pat, "REPLACE ");
else else
dynstr_append_mem(&insert_pat, "INSERT ", 7); dynstr_append_checked(&insert_pat, "INSERT ");
dynstr_append(&insert_pat, insert_option); dynstr_append_checked(&insert_pat, insert_option);
dynstr_append_mem(&insert_pat, "INTO ", 5); dynstr_append_checked(&insert_pat, "INTO ");
dynstr_append(&insert_pat, opt_quoted_table); dynstr_append_checked(&insert_pat, opt_quoted_table);
if (complete_insert) if (complete_insert)
{ {
dynstr_append_mem(&insert_pat, " (", 2); dynstr_append_checked(&insert_pat, " (");
} }
else else
{ {
dynstr_append_mem(&insert_pat, " VALUES ", 8); dynstr_append_checked(&insert_pat, " VALUES ");
if (!extended_insert) if (!extended_insert)
dynstr_append_mem(&insert_pat, "(", 1); dynstr_append_checked(&insert_pat, "(");
} }
} }
...@@ -1912,10 +1964,10 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1912,10 +1964,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{ {
if (init) if (init)
{ {
dynstr_append_mem(&insert_pat, ", ", 2); dynstr_append_checked(&insert_pat, ", ");
} }
init=1; init=1;
dynstr_append(&insert_pat, dynstr_append_checked(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0)); quote_name(row[SHOW_FIELDNAME], name_buff, 0));
} }
} }
...@@ -1930,10 +1982,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1930,10 +1982,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s", my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
result_table); result_table);
if (mysql_query_with_error_report(mysql, &result, query_buff)) if (mysql_query_with_error_report(mysql, &result, query_buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
/* Make an sql-file, if path was given iow. option -T was given */ /* Make an sql-file, if path was given iow. option -T was given */
if (!opt_no_create_info) if (!opt_no_create_info)
...@@ -1941,10 +1990,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1941,10 +1990,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (path) if (path)
{ {
if (!(sql_file= open_sql_file_for_table(table))) if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
write_header(sql_file, db); write_header(sql_file, db);
} }
if (!opt_xml && opt_comments) if (!opt_xml && opt_comments)
...@@ -1963,19 +2009,19 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1963,19 +2009,19 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (write_data) if (write_data)
{ {
if (opt_replace_into) if (opt_replace_into)
dynstr_append_mem(&insert_pat, "REPLACE ", 8); dynstr_append_checked(&insert_pat, "REPLACE ");
else else
dynstr_append_mem(&insert_pat, "INSERT ", 7); dynstr_append_checked(&insert_pat, "INSERT ");
dynstr_append(&insert_pat, insert_option); dynstr_append_checked(&insert_pat, insert_option);
dynstr_append_mem(&insert_pat, "INTO ", 5); dynstr_append_checked(&insert_pat, "INTO ");
dynstr_append(&insert_pat, result_table); dynstr_append_checked(&insert_pat, result_table);
if (opt_complete_insert) if (opt_complete_insert)
dynstr_append_mem(&insert_pat, " (", 2); dynstr_append_checked(&insert_pat, " (");
else else
{ {
dynstr_append_mem(&insert_pat, " VALUES ", 8); dynstr_append_checked(&insert_pat, " VALUES ");
if (!extended_insert) if (!extended_insert)
dynstr_append_mem(&insert_pat, "(", 1); dynstr_append_checked(&insert_pat, "(");
} }
} }
...@@ -1990,11 +2036,11 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1990,11 +2036,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file); check_io(sql_file);
} }
if (complete_insert) if (complete_insert)
dynstr_append_mem(&insert_pat, ", ", 2); dynstr_append_checked(&insert_pat, ", ");
} }
init=1; init=1;
if (opt_complete_insert) if (opt_complete_insert)
dynstr_append(&insert_pat, dynstr_append_checked(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0)); quote_name(row[SHOW_FIELDNAME], name_buff, 0));
if (!opt_no_create_info) if (!opt_no_create_info)
{ {
...@@ -2044,7 +2090,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -2044,7 +2090,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_progname, result_table, mysql_error(mysql)); my_progname, result_table, mysql_error(mysql));
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -2154,9 +2199,9 @@ continue_xml: ...@@ -2154,9 +2199,9 @@ continue_xml:
} }
if (opt_complete_insert) if (opt_complete_insert)
{ {
dynstr_append_mem(&insert_pat, ") VALUES ", 9); dynstr_append_checked(&insert_pat, ") VALUES ");
if (!extended_insert) if (!extended_insert)
dynstr_append_mem(&insert_pat, "(", 1); dynstr_append_checked(&insert_pat, "(");
} }
if (sql_file != md_result_file) if (sql_file != md_result_file)
{ {
...@@ -2203,7 +2248,6 @@ static void dump_triggers_for_table(char *table, ...@@ -2203,7 +2248,6 @@ static void dump_triggers_for_table(char *table,
{ {
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (mysql_num_rows(result)) if (mysql_num_rows(result))
...@@ -2262,24 +2306,28 @@ DELIMITER ;;\n"); ...@@ -2262,24 +2306,28 @@ DELIMITER ;;\n");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static char *add_load_option(char *ptr,const char *object, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *statement) const char *option_value)
{ {
if (object) if (!option_value)
{ {
/* Don't escape hex constants */ /* Null value means we don't add this option. */
if (object[0] == '0' && (object[1] == 'x' || object[1] == 'X')) return;
ptr= strxmov(ptr," ",statement," ",object,NullS);
else
{
/* char constant; escape */
ptr= strxmov(ptr," ",statement," '",NullS);
ptr= field_escape(ptr,object,(uint) strlen(object));
*ptr++= '\'';
}
} }
return ptr;
} /* add_load_option */ dynstr_append_checked(str, option);
if (strncmp(option_value, "0x", sizeof("0x")-1) == 0)
{
/* It's a hex constant, don't escape */
dynstr_append_checked(str, option_value);
}
else
{
/* char constant; escape */
field_escape(str, option_value);
}
}
/* /*
...@@ -2289,28 +2337,36 @@ static char *add_load_option(char *ptr,const char *object, ...@@ -2289,28 +2337,36 @@ static char *add_load_option(char *ptr,const char *object,
syntax errors from the SQL parser. syntax errors from the SQL parser.
*/ */
static char *field_escape(char *to,const char *from,uint length) static void field_escape(DYNAMIC_STRING* in, const char *from)
{ {
const char *end; uint end_backslashes= 0;
uint end_backslashes=0;
dynstr_append_checked(in, "'");
for (end= from+length; from != end; from++) while (*from)
{ {
*to++= *from; dynstr_append_mem_checked(in, from, 1);
if (*from == '\\') if (*from == '\\')
end_backslashes^=1; /* find odd number of backslashes */ end_backslashes^=1; /* find odd number of backslashes */
else else
{ {
if (*from == '\'' && !end_backslashes) if (*from == '\'' && !end_backslashes)
*to++= *from; /* We want a duplicate of "'" for MySQL */ {
/* We want a duplicate of "'" for MySQL */
dynstr_append_checked(in, "\'");
}
end_backslashes=0; end_backslashes=0;
} }
from++;
} }
/* Add missing backslashes if user has specified odd number of backs.*/ /* Add missing backslashes if user has specified odd number of backs.*/
if (end_backslashes) if (end_backslashes)
*to++= '\\'; dynstr_append_checked(in, "\\");
return to;
} /* field_escape */ dynstr_append_checked(in, "'");
}
static char *alloc_query_str(ulong size) static char *alloc_query_str(ulong size)
...@@ -2318,10 +2374,8 @@ static char *alloc_query_str(ulong size) ...@@ -2318,10 +2374,8 @@ static char *alloc_query_str(ulong size)
char *query; char *query;
if (!(query= (char*) my_malloc(size, MYF(MY_WME)))) if (!(query= (char*) my_malloc(size, MYF(MY_WME))))
{ die(EX_MYSQLERR, "Couldn't allocate a query string.");
ignore_errors= 0; /* Fatal error */
safe_exit(EX_MYSQLERR); /* Force exit */
}
return query; return query;
} }
...@@ -2341,13 +2395,14 @@ static char *alloc_query_str(ulong size) ...@@ -2341,13 +2395,14 @@ static char *alloc_query_str(ulong size)
void void
*/ */
static void dump_table(char *table, char *db) static void dump_table(char *table, char *db)
{ {
char ignore_flag; char ignore_flag;
char query_buf[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3]; char buf[200], table_buff[NAME_LEN+3];
DYNAMIC_STRING query_string;
char table_type[NAME_LEN]; char table_type[NAME_LEN];
char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table; char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
char *query= query_buf;
int error= 0; int error= 0;
ulong rownr, row_break, total_length, init_length; ulong rownr, row_break, total_length, init_length;
uint num_fields; uint num_fields;
...@@ -2401,44 +2456,69 @@ static void dump_table(char *table, char *db) ...@@ -2401,44 +2456,69 @@ static void dump_table(char *table, char *db)
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
verbose_msg("-- Sending SELECT query...\n"); verbose_msg("-- Sending SELECT query...\n");
init_dynamic_string_checked(&query_string, "", 1024, 1024);
if (path) if (path)
{ {
char filename[FN_REFLEN], tmp_path[FN_REFLEN]; char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
if (strlen(path) >= FN_REFLEN)
{
/*
This check is made because the some the file functions below
have FN_REFLEN sized stack allocated buffers and will cause
a crash even if the input destination buffer is large enough
to hold the output.
*/
die(EX_USAGE, "Input filename or options too long: %s", path);
}
/*
Convert the path to native os format
and resolve to the full filepath.
*/
convert_dirname(tmp_path,path,NullS);
my_load_path(tmp_path, tmp_path, NULL); my_load_path(tmp_path, tmp_path, NULL);
fn_format(filename, table, tmp_path, ".txt", 4); fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
my_delete(filename, MYF(0)); /* 'INTO OUTFILE' doesn't work, if
filename wasn't deleted */ /* Must delete the file that 'INTO OUTFILE' will write to */
my_delete(filename, MYF(0));
/* convert to a unix path name to stick into the query */
to_unix_path(filename); to_unix_path(filename);
my_snprintf(query, QUERY_LENGTH,
"SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '%s'", /* now build the query string */
filename);
end= strend(query); dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '");
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
if (fields_terminated || enclosed || opt_enclosed || escaped) if (fields_terminated || enclosed || opt_enclosed || escaped)
end= strmov(end, " FIELDS"); dynstr_append_checked(&query_string, " FIELDS");
end= add_load_option(end, fields_terminated, " TERMINATED BY");
end= add_load_option(end, enclosed, " ENCLOSED BY"); add_load_option(&query_string, " TERMINATED BY ", fields_terminated);
end= add_load_option(end, opt_enclosed, " OPTIONALLY ENCLOSED BY"); add_load_option(&query_string, " ENCLOSED BY ", enclosed);
end= add_load_option(end, escaped, " ESCAPED BY"); add_load_option(&query_string, " OPTIONALLY ENCLOSED BY ", opt_enclosed);
end= add_load_option(end, lines_terminated, " LINES TERMINATED BY"); add_load_option(&query_string, " ESCAPED BY ", escaped);
*end= '\0'; add_load_option(&query_string, " LINES TERMINATED BY ", lines_terminated);
my_snprintf(buff, sizeof(buff), " FROM %s", result_table); dynstr_append_checked(&query_string, " FROM ");
end= strmov(end,buff); dynstr_append_checked(&query_string, result_table);
if (where || order_by)
if (where)
{ {
query= alloc_query_str((ulong) ((end - query) + 1 + dynstr_append_checked(&query_string, " WHERE ");
(where ? strlen(where) + 7 : 0) + dynstr_append_checked(&query_string, where);
(order_by ? strlen(order_by) + 10 : 0)));
end= strmov(query, query_buf);
if (where)
end= strxmov(end, " WHERE ", where, NullS);
if (order_by)
end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
if (mysql_real_query(mysql, query, (uint) (end - query)))
if (order_by)
{
dynstr_append_checked(&query_string, " ORDER BY ");
dynstr_append_checked(&query_string, order_by);
}
if (mysql_real_query(mysql, query_string.str, query_string.length))
{ {
DB_error(mysql, "when executing 'SELECT INTO OUTFILE'"); DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -2452,41 +2532,38 @@ static void dump_table(char *table, char *db) ...@@ -2452,41 +2532,38 @@ static void dump_table(char *table, char *db)
result_table); result_table);
check_io(md_result_file); check_io(md_result_file);
} }
my_snprintf(query, QUERY_LENGTH,
"SELECT /*!40001 SQL_NO_CACHE */ * FROM %s", dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
result_table); dynstr_append_checked(&query_string, result_table);
if (where || order_by)
{
query= alloc_query_str((ulong) (strlen(query) + 1 +
(where ? strlen(where) + 7 : 0) +
(order_by ? strlen(order_by) + 10 : 0)));
end= strmov(query, query_buf);
if (where) if (where)
{
if (!opt_xml && opt_comments)
{ {
if (!opt_xml && opt_comments) fprintf(md_result_file, "-- WHERE: %s\n", where);
{ check_io(md_result_file);
fprintf(md_result_file, "-- WHERE: %s\n", where);
check_io(md_result_file);
}
end= strxmov(end, " WHERE ", where, NullS);
} }
if (order_by)
dynstr_append_checked(&query_string, " WHERE ");
dynstr_append_checked(&query_string, where);
}
if (order_by)
{
if (!opt_xml && opt_comments)
{ {
if (!opt_xml && opt_comments) fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
{ check_io(md_result_file);
fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
check_io(md_result_file);
}
end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
dynstr_append_checked(&query_string, " ORDER BY ");
dynstr_append_checked(&query_string, order_by);
} }
if (!opt_xml && !opt_compact) if (!opt_xml && !opt_compact)
{ {
fputs("\n", md_result_file); fputs("\n", md_result_file);
check_io(md_result_file); check_io(md_result_file);
} }
if (mysql_query_with_error_report(mysql, 0, query)) if (mysql_query_with_error_report(mysql, 0, query_string.str))
{ {
DB_error(mysql, "when retrieving data from server"); DB_error(mysql, "when retrieving data from server");
goto err; goto err;
...@@ -2560,14 +2637,9 @@ static void dump_table(char *table, char *db) ...@@ -2560,14 +2637,9 @@ static void dump_table(char *table, char *db)
ulong length= lengths[i]; ulong length= lengths[i];
if (!(field= mysql_fetch_field(res))) if (!(field= mysql_fetch_field(res)))
{ die(EX_CONSCHECK,
my_snprintf(query, QUERY_LENGTH, "Not enough fields from table %s! Aborting.\n",
"%s: Not enough fields from table %s! Aborting.\n", result_table);
my_progname, result_table);
fputs(query,stderr);
error= EX_CONSCHECK;
goto err;
}
/* /*
63 is my_charset_bin. If charsetnr is not 63, 63 is my_charset_bin. If charsetnr is not 63,
...@@ -2586,9 +2658,9 @@ static void dump_table(char *table, char *db) ...@@ -2586,9 +2658,9 @@ static void dump_table(char *table, char *db)
if (extended_insert && !opt_xml) if (extended_insert && !opt_xml)
{ {
if (i == 0) if (i == 0)
dynstr_set(&extended_row,"("); dynstr_set_checked(&extended_row,"(");
else else
dynstr_append(&extended_row,","); dynstr_append_checked(&extended_row,",");
if (row[i]) if (row[i])
{ {
...@@ -2603,15 +2675,10 @@ static void dump_table(char *table, char *db) ...@@ -2603,15 +2675,10 @@ static void dump_table(char *table, char *db)
- In non-HEX mode we need up to 2 bytes per character, - In non-HEX mode we need up to 2 bytes per character,
plus 2 bytes for leading and trailing '\'' characters. plus 2 bytes for leading and trailing '\'' characters.
*/ */
if (dynstr_realloc(&extended_row,length * 2+2)) dynstr_realloc_checked(&extended_row,length * 2+2);
{
fputs("Aborting dump (out of memory)",stderr);
error= EX_EOM;
goto err;
}
if (opt_hex_blob && is_blob) if (opt_hex_blob && is_blob)
{ {
dynstr_append(&extended_row, "0x"); dynstr_append_checked(&extended_row, "0x");
extended_row.length+= mysql_hex_string(extended_row.str + extended_row.length+= mysql_hex_string(extended_row.str +
extended_row.length, extended_row.length,
row[i], length); row[i], length);
...@@ -2619,13 +2686,13 @@ static void dump_table(char *table, char *db) ...@@ -2619,13 +2686,13 @@ static void dump_table(char *table, char *db)
} }
else else
{ {
dynstr_append(&extended_row,"'"); dynstr_append_checked(&extended_row,"'");
extended_row.length += extended_row.length +=
mysql_real_escape_string(&mysql_connection, mysql_real_escape_string(&mysql_connection,
&extended_row.str[extended_row.length], &extended_row.str[extended_row.length],
row[i],length); row[i],length);
extended_row.str[extended_row.length]='\0'; extended_row.str[extended_row.length]='\0';
dynstr_append(&extended_row,"'"); dynstr_append_checked(&extended_row,"'");
} }
} }
else else
...@@ -2634,30 +2701,26 @@ static void dump_table(char *table, char *db) ...@@ -2634,30 +2701,26 @@ static void dump_table(char *table, char *db)
char *ptr= row[i]; char *ptr= row[i];
if (my_isalpha(charset_info, *ptr) || (*ptr == '-' && if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
my_isalpha(charset_info, ptr[1]))) my_isalpha(charset_info, ptr[1])))
dynstr_append(&extended_row, "NULL"); dynstr_append_checked(&extended_row, "NULL");
else else
{ {
if (field->type == MYSQL_TYPE_DECIMAL) if (field->type == MYSQL_TYPE_DECIMAL)
{ {
/* add " signs around */ /* add " signs around */
dynstr_append(&extended_row, "'"); dynstr_append_checked(&extended_row, "'");
dynstr_append(&extended_row, ptr); dynstr_append_checked(&extended_row, ptr);
dynstr_append(&extended_row, "'"); dynstr_append_checked(&extended_row, "'");
} }
else else
dynstr_append(&extended_row, ptr); dynstr_append_checked(&extended_row, ptr);
} }
} }
} }
else else
dynstr_append(&extended_row,"''"); dynstr_append_checked(&extended_row,"''");
}
else if (dynstr_append(&extended_row,"NULL"))
{
fputs("Aborting dump (out of memory)",stderr);
error= EX_EOM;
goto err;
} }
else
dynstr_append_checked(&extended_row,"NULL");
} }
else else
{ {
...@@ -2743,7 +2806,7 @@ static void dump_table(char *table, char *db) ...@@ -2743,7 +2806,7 @@ static void dump_table(char *table, char *db)
if (extended_insert) if (extended_insert)
{ {
ulong row_length; ulong row_length;
dynstr_append(&extended_row,")"); dynstr_append_checked(&extended_row,")");
row_length= 2 + extended_row.length; row_length= 2 + extended_row.length;
if (total_length + row_length < opt_net_buffer_length) if (total_length + row_length < opt_net_buffer_length)
{ {
...@@ -2779,14 +2842,14 @@ static void dump_table(char *table, char *db) ...@@ -2779,14 +2842,14 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
if (mysql_errno(mysql)) if (mysql_errno(mysql))
{ {
my_snprintf(query, QUERY_LENGTH, my_snprintf(buf, sizeof(buf),
"%s: Error %d: %s when dumping table %s at row: %ld\n", "%s: Error %d: %s when dumping table %s at row: %ld\n",
my_progname, my_progname,
mysql_errno(mysql), mysql_errno(mysql),
mysql_error(mysql), mysql_error(mysql),
result_table, result_table,
rownr); rownr);
fputs(query,stderr); fputs(buf,stderr);
error= EX_CONSCHECK; error= EX_CONSCHECK;
goto err; goto err;
} }
...@@ -2809,15 +2872,13 @@ static void dump_table(char *table, char *db) ...@@ -2809,15 +2872,13 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
} }
mysql_free_result(res); mysql_free_result(res);
if (query != query_buf) dynstr_free(&query_string);
my_free(query, MYF(MY_ALLOW_ZERO_PTR));
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
err: err:
if (query != query_buf) dynstr_free(&query_string);
my_free(query, MYF(MY_ALLOW_ZERO_PTR)); maybe_exit(error);
safe_exit(error);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} /* dump_table */ } /* dump_table */
...@@ -2864,25 +2925,25 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) ...@@ -2864,25 +2925,25 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
mysql_real_escape_string(mysql, name_buff, db, strlen(db)); mysql_real_escape_string(mysql, name_buff, db, strlen(db));
init_dynamic_string(&where, " AND TABLESPACE_NAME IN (" init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
"SELECT DISTINCT TABLESPACE_NAME FROM" "SELECT DISTINCT TABLESPACE_NAME FROM"
" INFORMATION_SCHEMA.PARTITIONS" " INFORMATION_SCHEMA.PARTITIONS"
" WHERE" " WHERE"
" TABLE_SCHEMA='", 256, 1024); " TABLE_SCHEMA='", 256, 1024);
dynstr_append(&where, name_buff); dynstr_append_checked(&where, name_buff);
dynstr_append(&where, "' AND TABLE_NAME IN ("); dynstr_append_checked(&where, "' AND TABLE_NAME IN (");
for (i=0 ; i<tables ; i++) for (i=0 ; i<tables ; i++)
{ {
mysql_real_escape_string(mysql, name_buff, mysql_real_escape_string(mysql, name_buff,
table_names[i], strlen(table_names[i])); table_names[i], strlen(table_names[i]));
dynstr_append(&where, "'"); dynstr_append_checked(&where, "'");
dynstr_append(&where, name_buff); dynstr_append_checked(&where, name_buff);
dynstr_append(&where, "',"); dynstr_append_checked(&where, "',");
} }
dynstr_trunc(&where, 1); dynstr_trunc(&where, 1);
dynstr_append(&where,"))"); dynstr_append_checked(&where,"))");
DBUG_PRINT("info",("Dump TS for Tables where: %s",where.str)); DBUG_PRINT("info",("Dump TS for Tables where: %s",where.str));
r= dump_tablespaces(where.str); r= dump_tablespaces(where.str);
...@@ -2896,7 +2957,7 @@ static int dump_tablespaces_for_databases(char** databases) ...@@ -2896,7 +2957,7 @@ static int dump_tablespaces_for_databases(char** databases)
int r; int r;
int i; int i;
init_dynamic_string(&where, " AND TABLESPACE_NAME IN (" init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
"SELECT DISTINCT TABLESPACE_NAME FROM" "SELECT DISTINCT TABLESPACE_NAME FROM"
" INFORMATION_SCHEMA.PARTITIONS" " INFORMATION_SCHEMA.PARTITIONS"
" WHERE" " WHERE"
...@@ -2907,12 +2968,12 @@ static int dump_tablespaces_for_databases(char** databases) ...@@ -2907,12 +2968,12 @@ static int dump_tablespaces_for_databases(char** databases)
char db_name_buff[NAME_LEN*2+3]; char db_name_buff[NAME_LEN*2+3];
mysql_real_escape_string(mysql, db_name_buff, mysql_real_escape_string(mysql, db_name_buff,
databases[i], strlen(databases[i])); databases[i], strlen(databases[i]));
dynstr_append(&where, "'"); dynstr_append_checked(&where, "'");
dynstr_append(&where, db_name_buff); dynstr_append_checked(&where, db_name_buff);
dynstr_append(&where, "',"); dynstr_append_checked(&where, "',");
} }
dynstr_trunc(&where, 1); dynstr_trunc(&where, 1);
dynstr_append(&where,"))"); dynstr_append_checked(&where,"))");
DBUG_PRINT("info",("Dump TS for DBs where: %s",where.str)); DBUG_PRINT("info",("Dump TS for DBs where: %s",where.str));
r= dump_tablespaces(where.str); r= dump_tablespaces(where.str);
...@@ -2934,7 +2995,7 @@ static int dump_tablespaces(char* ts_where) ...@@ -2934,7 +2995,7 @@ static int dump_tablespaces(char* ts_where)
char *ubs; char *ubs;
char *endsemi; char *endsemi;
init_dynamic_string(&sqlbuf, init_dynamic_string_checked(&sqlbuf,
"SELECT LOGFILE_GROUP_NAME," "SELECT LOGFILE_GROUP_NAME,"
" FILE_NAME," " FILE_NAME,"
" TOTAL_EXTENTS," " TOTAL_EXTENTS,"
...@@ -2947,16 +3008,16 @@ static int dump_tablespaces(char* ts_where) ...@@ -2947,16 +3008,16 @@ static int dump_tablespaces(char* ts_where)
256, 1024); 256, 1024);
if(ts_where) if(ts_where)
{ {
dynstr_append(&sqlbuf, dynstr_append_checked(&sqlbuf,
" AND LOGFILE_GROUP_NAME IN (" " AND LOGFILE_GROUP_NAME IN ("
"SELECT DISTINCT LOGFILE_GROUP_NAME" "SELECT DISTINCT LOGFILE_GROUP_NAME"
" FROM INFORMATION_SCHEMA.FILES" " FROM INFORMATION_SCHEMA.FILES"
" WHERE FILE_TYPE = 'DATAFILE'" " WHERE FILE_TYPE = 'DATAFILE'"
); );
dynstr_append(&sqlbuf, ts_where); dynstr_append_checked(&sqlbuf, ts_where);
dynstr_append(&sqlbuf, ")"); dynstr_append_checked(&sqlbuf, ")");
} }
dynstr_append(&sqlbuf, dynstr_append_checked(&sqlbuf,
" GROUP BY LOGFILE_GROUP_NAME, FILE_NAME" " GROUP BY LOGFILE_GROUP_NAME, FILE_NAME"
", ENGINE" ", ENGINE"
" ORDER BY LOGFILE_GROUP_NAME"); " ORDER BY LOGFILE_GROUP_NAME");
...@@ -3029,7 +3090,7 @@ static int dump_tablespaces(char* ts_where) ...@@ -3029,7 +3090,7 @@ static int dump_tablespaces(char* ts_where)
} }
} }
dynstr_free(&sqlbuf); dynstr_free(&sqlbuf);
init_dynamic_string(&sqlbuf, init_dynamic_string_checked(&sqlbuf,
"SELECT DISTINCT TABLESPACE_NAME," "SELECT DISTINCT TABLESPACE_NAME,"
" FILE_NAME," " FILE_NAME,"
" LOGFILE_GROUP_NAME," " LOGFILE_GROUP_NAME,"
...@@ -3041,9 +3102,9 @@ static int dump_tablespaces(char* ts_where) ...@@ -3041,9 +3102,9 @@ static int dump_tablespaces(char* ts_where)
256, 1024); 256, 1024);
if(ts_where) if(ts_where)
dynstr_append(&sqlbuf, ts_where); dynstr_append_checked(&sqlbuf, ts_where);
dynstr_append(&sqlbuf, " ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME"); dynstr_append_checked(&sqlbuf, " ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME");
if (mysql_query_with_error_report(mysql, &tableres, sqlbuf.str)) if (mysql_query_with_error_report(mysql, &tableres, sqlbuf.str))
return 1; return 1;
...@@ -3254,8 +3315,8 @@ static int init_dumping(char *database, int init_func(char*)) ...@@ -3254,8 +3315,8 @@ static int init_dumping(char *database, int init_func(char*))
check_io(md_result_file); check_io(md_result_file);
} }
} }
if (extended_insert && init_dynamic_string(&extended_row, "", 1024, 1024)) if (extended_insert)
exit(EX_EOM); init_dynamic_string_checked(&extended_row, "", 1024, 1024);
return 0; return 0;
} /* init_dumping */ } /* init_dumping */
...@@ -3288,11 +3349,11 @@ static int dump_all_tables_in_db(char *database) ...@@ -3288,11 +3349,11 @@ static int dump_all_tables_in_db(char *database)
if (lock_tables) if (lock_tables)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024); init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)) ; numrows++) for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
{ {
dynstr_append(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
} }
if (numrows && mysql_real_query(mysql, query.str, query.length-1)) if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES"); DB_error(mysql, "when using LOCK TABLES");
...@@ -3371,11 +3432,11 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -3371,11 +3432,11 @@ static my_bool dump_all_views_in_db(char *database)
if (lock_tables) if (lock_tables)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024); init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)); numrows++) for (numrows= 0 ; (table= getTableName(1)); numrows++)
{ {
dynstr_append(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
} }
if (numrows && mysql_real_query(mysql, query.str, query.length-1)) if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES"); DB_error(mysql, "when using LOCK TABLES");
...@@ -3427,9 +3488,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root) ...@@ -3427,9 +3488,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root)
quote_for_like(old_table_name, show_name_buff)); quote_for_like(old_table_name, show_name_buff));
if (mysql_query_with_error_report(mysql, 0, query)) if (mysql_query_with_error_report(mysql, 0, query))
{ return NullS;
safe_exit(EX_MYSQLERR);
}
if ((table_res= mysql_store_result(mysql))) if ((table_res= mysql_store_result(mysql)))
{ {
...@@ -3465,9 +3524,9 @@ static int dump_selected_tables(char *db, char **table_names, int tables) ...@@ -3465,9 +3524,9 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
init_alloc_root(&root, 8192, 0); init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *)))) if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
exit(EX_EOM); die(EX_EOM, "alloc_root failure.");
init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024); init_dynamic_string_checked(&lock_tables_query, "LOCK TABLES ", 256, 1024);
for (; tables > 0 ; tables-- , table_names++) for (; tables > 0 ; tables-- , table_names++)
{ {
/* the table name passed on commandline may be wrong case */ /* the table name passed on commandline may be wrong case */
...@@ -3476,16 +3535,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables) ...@@ -3476,16 +3535,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
/* Add found table name to lock_tables_query */ /* Add found table name to lock_tables_query */
if (lock_tables) if (lock_tables)
{ {
dynstr_append(&lock_tables_query, quote_name(*pos, table_buff, 1)); dynstr_append_checked(&lock_tables_query, quote_name(*pos, table_buff, 1));
dynstr_append(&lock_tables_query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&lock_tables_query, " READ /*!32311 LOCAL */,");
} }
pos++; pos++;
} }
else else
{ {
my_printf_error(0,"Couldn't find table: \"%s\"\n", MYF(0), maybe_die(EX_ILLEGAL_TABLE, "Couldn't find table: \"%s\"", *table_names);
*table_names);
safe_exit(EX_ILLEGAL_TABLE);
/* We shall countinue here, if --force was given */ /* We shall countinue here, if --force was given */
} }
} }
...@@ -3906,12 +3963,12 @@ static int replace(DYNAMIC_STRING *ds_str, ...@@ -3906,12 +3963,12 @@ static int replace(DYNAMIC_STRING *ds_str,
const char *start= strstr(ds_str->str, search_str); const char *start= strstr(ds_str->str, search_str);
if (!start) if (!start)
return 1; return 1;
init_dynamic_string(&ds_tmp, "", init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256); ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str); dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, replace_str, replace_len); dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len); dynstr_append_checked(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str); dynstr_set_checked(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
return 0; return 0;
} }
...@@ -3957,10 +4014,7 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3957,10 +4014,7 @@ static my_bool get_view_structure(char *table, char* db)
my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table); my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table);
if (mysql_query_with_error_report(mysql, &table_res, query)) if (mysql_query_with_error_report(mysql, &table_res, query))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
/* Check if this is a view */ /* Check if this is a view */
field= mysql_fetch_field_direct(table_res, 0); field= mysql_fetch_field_direct(table_res, 0);
...@@ -3974,10 +4028,8 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3974,10 +4028,8 @@ static my_bool get_view_structure(char *table, char* db)
if (path) if (path)
{ {
if (!(sql_file= open_sql_file_for_table(table))) if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1); DBUG_RETURN(1);
}
write_header(sql_file, db); write_header(sql_file, db);
} }
...@@ -4023,14 +4075,14 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -4023,14 +4075,14 @@ static my_bool get_view_structure(char *table, char* db)
/* Save the result of SHOW CREATE TABLE in ds_view */ /* Save the result of SHOW CREATE TABLE in ds_view */
row= mysql_fetch_row(table_res); row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res); lengths= mysql_fetch_lengths(table_res);
init_dynamic_string(&ds_view, row[1], lengths[1] + 1, 1024); init_dynamic_string_checked(&ds_view, row[1], lengths[1] + 1, 1024);
mysql_free_result(table_res); mysql_free_result(table_res);
/* Get the result from "select ... information_schema" */ /* Get the result from "select ... information_schema" */
if (!(table_res= mysql_store_result(mysql)) || if (!(table_res= mysql_store_result(mysql)) ||
!(row= mysql_fetch_row(table_res))) !(row= mysql_fetch_row(table_res)))
{ {
safe_exit(EX_MYSQLERR); DB_error(mysql, "when trying to save the result of SHOW CREATE TABLE in ds_view.");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -4102,6 +4154,45 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -4102,6 +4154,45 @@ static my_bool get_view_structure(char *table, char* db)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*
The following functions are wrappers for the dynamic string functions
and if they fail, the wrappers will terminate the current process.
*/
#define DYNAMIC_STR_ERROR_MSG "Couldn't perform DYNAMIC_STRING operation"
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
uint init_alloc, uint alloc_increment)
{
if (init_dynamic_string(str, init_str, init_alloc, alloc_increment))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src)
{
if (dynstr_append(dest, src))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str)
{
if (dynstr_set(str, init_str))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
uint length)
{
if (dynstr_append_mem(str, append, length))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size)
{
if (dynstr_realloc(str, additional_size))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
......
...@@ -1568,29 +1568,17 @@ create table t3(a varchar(30) primary key, b int not null); ...@@ -1568,29 +1568,17 @@ create table t3(a varchar(30) primary key, b int not null);
test_sequence test_sequence
------ Testing with illegal table names ------ ------ Testing with illegal table names ------
mysqldump: Couldn't find table: "\d-2-1.sql" mysqldump: Couldn't find table: "\d-2-1.sql"
mysqldump: Couldn't find table: "\t1" mysqldump: Couldn't find table: "\t1"
mysqldump: Couldn't find table: "\t1" mysqldump: Couldn't find table: "\t1"
mysqldump: Couldn't find table: "\\t1" mysqldump: Couldn't find table: "\\t1"
mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t\1"
mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t\1"
mysqldump: Couldn't find table: "t/1" mysqldump: Couldn't find table: "t/1"
mysqldump: Couldn't find table: "T_1" mysqldump: Couldn't find table: "T_1"
mysqldump: Couldn't find table: "T%1" mysqldump: Couldn't find table: "T%1"
mysqldump: Couldn't find table: "T'1" mysqldump: Couldn't find table: "T'1"
mysqldump: Couldn't find table: "T_1" mysqldump: Couldn't find table: "T_1"
mysqldump: Couldn't find table: "T_" mysqldump: Couldn't find table: "T_"
test_sequence test_sequence
------ Testing with illegal database names ------ ------ Testing with illegal database names ------
mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database
...@@ -3217,6 +3205,13 @@ INSERT INTO t1 VALUES(1,0xff00fef0); ...@@ -3217,6 +3205,13 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#26346: stack + buffer overrun in mysqldump
#
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
mysqldump: Input filename or options too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
#
# End of 5.0 tests # End of 5.0 tests
# #
drop table if exists t1; drop table if exists t1;
......
...@@ -1431,6 +1431,30 @@ INSERT INTO t1 VALUES(1,0xff00fef0); ...@@ -1431,6 +1431,30 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#26346: stack + buffer overrun in mysqldump
--echo #
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
# too long a file path causes an error
--error 1
--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
DROP TABLE t1;
--echo # --echo #
--echo # End of 5.0 tests --echo # End of 5.0 tests
--echo # --echo #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment