259
261
if (!internal::dirname_length(ex->file_name))
261
strcpy(name, data_home_real);
262
strncat(name, tdb, FN_REFLEN-strlen(data_home_real)-1);
263
strcpy(name, getDataHomeCatalog().c_str());
264
strncat(name, "/", 1);
265
strncat(name, tdb, FN_REFLEN-getDataHomeCatalog().size());
263
266
(void) internal::fn_format(name, ex->file_name, name, "",
264
267
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
268
(void) internal::fn_format(name, ex->file_name, data_home_real, "",
271
(void) internal::fn_format(name, ex->file_name, getDataHomeCatalog().c_str(), "",
269
272
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
271
if (opt_secure_file_priv &&
272
strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
274
if (opt_secure_file_priv)
274
/* Read only allowed from within dir specified by secure_file_priv */
275
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
276
fs::path secure_file_path(fs::system_complete(fs::path(opt_secure_file_priv)));
277
fs::path target_path(fs::system_complete(fs::path(name)));
278
if (target_path.file_string().substr(0, secure_file_path.file_string().size()) != secure_file_path.file_string())
280
/* Read only allowed from within dir specified by secure_file_priv */
281
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
279
286
struct stat stat_info;