diff options
author | unknown <monty@hundin.mysql.fi> | 2002-02-13 22:01:42 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-02-13 22:01:42 +0200 |
commit | 345f3854515c2a6a44d6d2a02b19ad320b8b69d8 (patch) | |
tree | 9f68542907d019994c33a2fe3cbcdbb612b0bb8b /sql | |
parent | 700513a41a06b504a24020ab9e5216450f01e01f (diff) | |
parent | a0ea16f1c25508100df3bf4afb390ce368b5b86f (diff) | |
download | mariadb-git-345f3854515c2a6a44d6d2a02b19ad320b8b69d8.tar.gz |
Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql
BitKeeper/etc/logging_ok:
auto-union
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysql_priv.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 12 | ||||
-rw-r--r-- | sql/sql_load.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 9 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 16 |
5 files changed, 28 insertions, 13 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a569fecfc9d..072cbf540af 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -524,7 +524,7 @@ extern pthread_cond_t COND_refresh,COND_thread_count, COND_binlog_update, COND_slave_stopped, COND_slave_start; extern pthread_attr_t connection_attrib; extern bool opt_endinfo, using_udf_functions, locked_in_memory, - opt_using_transactions, use_temp_pool; + opt_using_transactions, use_temp_pool, opt_local_infile; extern char f_fyllchar; extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ha_read_key_count, ha_read_next_count, ha_read_prev_count, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a7c59dc3c7f..09c05a6463f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -287,6 +287,7 @@ ulong bytes_sent = 0L, bytes_received = 0L; bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory; bool opt_using_transactions, using_update_log, opt_warnings=0; +bool opt_local_infile=1; bool volatile abort_loop,select_thread_in_use,grant_option; bool volatile ready_to_exit,shutdown_in_progress; ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ @@ -683,8 +684,9 @@ pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) static sig_handler print_signal_warning(int sig) { - sql_print_error("Warning: Got signal %d from thread %d", - sig,my_thread_id()); + if (opt_warnings) + sql_print_error("Warning: Got signal %d from thread %d", + sig,my_thread_id()); #ifdef DONT_REMEMBER_SIGNAL sigset(sig,print_signal_warning); /* int. thread system calls */ #endif @@ -2612,7 +2614,7 @@ enum options { OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_SAFE_USER_CREATE, OPT_SQL_MODE, - OPT_SLAVE_SKIP_ERRORS + OPT_SLAVE_SKIP_ERRORS, OPT_LOCAL_INFILE }; static struct option long_options[] = { @@ -2676,6 +2678,7 @@ static struct option long_options[] = { {"init-file", required_argument, 0, (int) OPT_INIT_FILE}, {"log", optional_argument, 0, 'l'}, {"language", required_argument, 0, 'L'}, + {"local-infile", optional_argument, 0, (int) OPT_LOCAL_INFILE}, {"log-bin", optional_argument, 0, (int) OPT_BIN_LOG}, {"log-bin-index", required_argument, 0, (int) OPT_BIN_LOG_INDEX}, {"log-isam", optional_argument, 0, (int) OPT_ISAM_LOG}, @@ -3468,6 +3471,9 @@ static void get_options(int argc,char **argv) case 'P': mysql_port= (unsigned int) atoi(optarg); break; + case OPT_LOCAL_INFILE: + opt_local_infile= test(!optarg || atoi(optarg) != 0); + break; case OPT_SLAVE_SKIP_ERRORS: init_slave_skip_errors(optarg); break; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 9d3b899d31b..dd8487ceecc 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -132,7 +132,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (read_file_from_client && handle_duplicates == DUP_ERROR) handle_duplicates=DUP_IGNORE; - if (read_file_from_client && (thd->client_capabilities & CLIENT_LOCAL_FILES)) + if (read_file_from_client) { char tmp [FN_REFLEN+1],*end; DBUG_PRINT("info",("reading local file")); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 48b48dc77a7..9b439081d50 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1796,13 +1796,20 @@ mysql_execute_command(void) { uint privilege= (lex->duplicates == DUP_REPLACE ? INSERT_ACL | UPDATE_ACL | DELETE_ACL : INSERT_ACL); - if (!(lex->local_file && (thd->client_capabilities & CLIENT_LOCAL_FILES))) + + if (!lex->local_file) { if (check_access(thd,privilege | FILE_ACL,tables->db)) goto error; } else { + if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) || + ! opt_local_infile) + { + send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); + goto error; + } if (check_access(thd,privilege,tables->db,&tables->grant.privilege) || grant_option && check_grant(thd,privilege,tables)) goto error; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 42872399dec..08fab22629a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2356,8 +2356,9 @@ use: USE_SYM ident load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING { - Lex->sql_command= SQLCOM_LOAD; - Lex->local_file= $4; + LEX *lex= Lex; + lex->sql_command= SQLCOM_LOAD; + lex->local_file= $4; if (!(Lex->exchange= new sql_exchange($6.str,0))) YYABORT; Lex->field_list.empty(); @@ -2643,11 +2644,12 @@ set: SET opt_option { THD *thd=current_thd; - Lex->sql_command= SQLCOM_SET_OPTION; - Lex->options=thd->options; - Lex->select_limit=thd->default_select_limit; - Lex->gemini_spin_retries=thd->gemini_spin_retries; - Lex->tx_isolation=thd->tx_isolation; + LEX *lex= &thd->lex; + lex->sql_command= SQLCOM_SET_OPTION; + lex->options=thd->options; + lex->select_limit=thd->default_select_limit; + lex->gemini_spin_retries=thd->gemini_spin_retries; + lex->tx_isolation=thd->tx_isolation; } option_value_list |