Bug #5038 Cannot disable LOAD DATA LOCAL INFILE from client
Submitted: 13 Aug 2004 20:53 Modified: 17 Aug 2004 17:44
Reporter: Dean Ellis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.4 OS:
Assigned to: Guilhem Bichot CPU Architecture:Any

[13 Aug 2004 20:53] Dean Ellis
Description:
LOAD DATA LOCAL INFILE cannot be explicitly disabled from the client side via the C API.

How to repeat:
#include "mysql.h"
#include <unistd.h>
 
int main()
{
 MYSQL* m;
 unsigned int i= 0;
 char dr[]="DROP TABLE IF EXISTS t1";
 char cr[]="CREATE TABLE t1 ( a BLOB )";
 char ldi[]="LOAD DATA LOCAL INFILE '/bin/sh' INTO TABLE t1";
 
 m= mysql_init(NULL);
 mysql_options(m,MYSQL_OPT_LOCAL_INFILE,(char*)&i);
 mysql_real_connect(m,"localhost","root","","test",0,NULL,0);
 mysql_real_query(m, dr, strlen(dr));
 mysql_real_query(m, cr, strlen(cr));
 mysql_real_query(m, ldi, strlen(ldi));
 printf("Error: %s\n",mysql_error(m));
 mysql_real_query(m, dr, strlen(dr));
 mysql_close(m);
 return 0;
}

Suggested fix:
n/a
[14 Aug 2004 15:54] Guilhem Bichot
Hi Dean,
Can't repeat: I start a 4.0 or 4.1 server with --enable-local-infile (or with nothing, as it's the default), and with the mysql_options(m,MYSQL_OPT_LOCAL_INFILE,(char*)&i); I get:
Error: The used command is not allowed with this MySQL version
and without it I get:
Error:
Looks all normal to me. When I start server with --disable-local-infile I get "the used command etc".
Help?
[16 Aug 2004 17:40] Dean Ellis
All I do is recompile/relink the same case:

Linked to libmysqlclient.so.12, connecting to 4.0.21:

Error: The used command is not allowed with this MySQL version

Linked to libmysqlclient.so.14, connecting to 4.1.4:

Error:

Both servers have local infile enabled (ie: the default setting).
[17 Aug 2004 17:44] Guilhem Bichot
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

ChangeSet@1.1958.2.1, 2004-08-17 17:33:21+02:00, guilhem@mysql.com