diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2009-02-21 09:36:07 +0000 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2009-02-21 09:36:07 +0000 |
commit | d822ab8957ad636de01eaabfc4981f0e0d0c5b47 (patch) | |
tree | da0f9ea1883f6601834e69916f437846be614243 /sql/sql_load.cc | |
parent | 9b36597ac1836020d875538b891cc7ebbcbbd305 (diff) | |
download | mariadb-git-d822ab8957ad636de01eaabfc4981f0e0d0c5b47.tar.gz |
BUG#38174 secure-file-priv breaks LOAD DATA INFILE replication in statement mode
If secure-file-priv was set on slave, it became unable to execute
LOAD DATA INFILE statements sent from master using mixed or
statement-based replication.
This patch fixes the issue by ignoring this security restriction
and checking if the files are created and read by the slave in the
--slave-load-tmpdir while executing the SQL Thread.
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r-- | sql/sql_load.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 239fb1d49f3..0acc22c3daf 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -15,10 +15,10 @@ /* Copy data from a textfile to table */ - #include "mysql_priv.h" #include <my_dir.h> #include <m_ctype.h> +#include "rpl_mi.h" #include "sql_repl.h" #include "sp_head.h" #include "sql_trigger.h" @@ -310,8 +310,31 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, is_fifo = 1; #endif - if (opt_secure_file_priv && - strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv))) + if (thd->slave_thread) + { +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) + if (strncmp(active_mi->rli.slave_patternload_file, name, + active_mi->rli.slave_patternload_file_size)) + { + /* + LOAD DATA INFILE in the slave SQL Thread can only read from + --slave-load-tmpdir". This should never happen. Please, report a bug. + */ + + sql_print_error("LOAD DATA INFILE in the slave SQL Thread can only read from --slave-load-tmpdir. " \ + "Please, report a bug."); + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--slave-load-tmpdir"); + DBUG_RETURN(TRUE); + } +#else + /* + This is impossible and should never happen. + */ + DBUG_ASSERT(FALSE); +#endif + } + else if (opt_secure_file_priv && + strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv))) { /* Read only allowed from within dir specified by secure_file_priv */ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); |