Internal Security: Preventing Unauthorized Filesystem Access


Enabling or Disabling LOCAL Capability for LOAD DATA

The LOCAL capability for the LOAD DATA statement need not be enabled. It can be controlled at build time and at runtime as follows:

  • At build time, LOCAL capability for the client library can be enabled or disabled by default by using the --enable-local-infile or --disable-local-infile option when you run configure.

  • At runtime, the server can be started with the --local-infile or --skip-local-infile options to enable or disable LOCAL capability on the server side.

If LOCAL is disabled on the server side, clients cannot use this capability at all. If LOCAL is enabled on the server side, the client library might still have LOCAL disabled by default on the client side, but certain programs may allow it to be enabled on demand. For example, mysql has a --local-infile option to allow LOCAL, and mysqlimport has a --local option.

For programs that have no explicit option for enabling or disabling LOCAL, you might still be able to control this capability if the program reads option files implicitly. This depends on whether the program invokes the mysql_options() C API function with the MYSQL_READ_DEFAULT_FILE or MYSQL_READ_DEFAULT_GROUP option that causes option files to be read when the connection to the server is made. If the program does use mysql_options() in this way, you can list a local-infile or disable-local-infile option in an appropriate option file to enable or disable LOCAL. The mysql_options() function is described in Appendix G, "C API Reference."

Programming interfaces for MySQL in other languages also may be able to control LOCAL this way if they are based on the C API and invoke mysql_options(). For example, in a Perl DBI script, you can use the mysql_read_default_file and mysql_read_default_group options in the data source name string that controls how the script connects to the MySQL server.



MySQL The definitive guide to using, programming, and administering MySQL 4. 1 and 5. 0
Mysql: the Definitive Guide to Using, Programming, and Administering Mysql 4.1 and 5.0
ISBN: B003A1PKHY
EAN: N/A
Year: 2004
Pages: 190
Authors: Paul Dubois

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net