|
Connector/C has 2 options for LOAD DATA LOCAL INFILE
1) Disallow LOAD DATA LOCAL INFILE in general:
mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, &onoff);
|
2nd) Callback handler to verify the filename (was added in C/C 2.3.0).
If the server sends request to client to send a file, the client will check via callback if the filename matches with filename in the previously sent statement.
int verify_local_infile_callback(void *data, const char *filename)
|
{
|
char *orig_filename= (char *)data;
|
return strcmp(filename, orig_filename);
|
}
|
..
|
|
strcpy(orig_file, "onlythisfile_isallowed.csv");
|
mysql_optionsv(mysql, MARIADB_OPT_VERIFY_LOCAL_INFILE_CALLBACK, verify_local_infile_callback, (void *)orig_file);
|
|