|
35 | 35 | #include "sql_insert.h" // mysql_insert |
36 | 36 | #include "sql_update.h" // mysql_update, mysql_multi_update |
37 | 37 | #include "sql_partition.h" // struct partition_info |
| 38 | +#ifdef WITH_PARTITION_STORAGE_ENGINE |
| 39 | +#include "partition_info.h" // has_external_data_or_index_dir |
| 40 | +#endif /* WITH_PARTITION_STORAGE_ENGINE */ |
38 | 41 | #include "sql_db.h" // mysql_change_db, mysql_create_db, |
39 | 42 | // mysql_rm_db, mysql_upgrade_db, |
40 | 43 | // mysql_alter_db, |
@@ -2413,14 +2416,22 @@ case SQLCOM_PREPARE: |
2413 | 2416 | copy. |
2414 | 2417 | */ |
2415 | 2418 | Alter_info alter_info(lex->alter_info, thd->mem_root); |
2416 | | - |
2417 | 2419 | if (thd->is_fatal_error) |
2418 | 2420 | { |
2419 | 2421 | /* If out of memory when creating a copy of alter_info. */ |
2420 | 2422 | res= 1; |
2421 | 2423 | goto end_with_restore_list; |
2422 | 2424 | } |
2423 | 2425 |
|
| 2426 | + if (((lex->create_info.used_fields & HA_CREATE_USED_DATADIR) != 0 || |
| 2427 | + (lex->create_info.used_fields & HA_CREATE_USED_INDEXDIR) != 0) && |
| 2428 | + check_access(thd, FILE_ACL, NULL, NULL, NULL, FALSE, FALSE)) |
| 2429 | + { |
| 2430 | + res= 1; |
| 2431 | + my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "FILE"); |
| 2432 | + goto end_with_restore_list; |
| 2433 | + } |
| 2434 | + |
2424 | 2435 | if ((res= create_table_precheck(thd, select_tables, create_table))) |
2425 | 2436 | goto end_with_restore_list; |
2426 | 2437 |
|
@@ -2458,6 +2469,12 @@ case SQLCOM_PREPARE: |
2458 | 2469 | #ifdef WITH_PARTITION_STORAGE_ENGINE |
2459 | 2470 | { |
2460 | 2471 | partition_info *part_info= thd->lex->part_info; |
| 2472 | + if (part_info != NULL && has_external_data_or_index_dir(*part_info) && |
| 2473 | + check_access(thd, FILE_ACL, NULL, NULL, NULL, FALSE, FALSE)) |
| 2474 | + { |
| 2475 | + res= -1; |
| 2476 | + goto end_with_restore_list; |
| 2477 | + } |
2461 | 2478 | if (part_info && !(part_info= thd->lex->part_info->get_clone(true))) |
2462 | 2479 | { |
2463 | 2480 | res= -1; |
|
0 commit comments