1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 09:34:10 +02:00

MySQL: Disallow LOAD DATA LOCAL INFILE

This commit is contained in:
Jakub Vrana
2018-06-26 08:53:12 +02:00
parent 2780eb01f5
commit c564a8ef50
5 changed files with 16 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ if (!defined("DRIVER")) {
(!is_numeric($port) ? $port : $socket),
($ssl ? 64 : 0) // 64 - MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (not available before PHP 5.6.16)
);
$this->options(MYSQLI_OPT_LOCAL_INFILE, false);
return $return;
}
@@ -56,7 +57,7 @@ if (!defined("DRIVER")) {
}
}
} elseif (extension_loaded("mysql") && !(ini_get("sql.safe_mode") && extension_loaded("pdo_mysql"))) {
} elseif (extension_loaded("mysql") && !((ini_bool("sql.safe_mode") || ini_bool("mysql.allow_local_infile")) && extension_loaded("pdo_mysql"))) {
class Min_DB {
var
$extension = "MySQL", ///< @var string extension name
@@ -74,6 +75,10 @@ if (!defined("DRIVER")) {
* @return bool
*/
function connect($server, $username, $password) {
if (ini_bool("mysql.allow_local_infile")) {
$this->error = lang('Disable %s or enable %s or %s extensions.', "'mysql.allow_local_infile'", "MySQLi", "PDO_MySQL");
return false;
}
$this->_link = @mysql_connect(
($server != "" ? $server : ini_get("mysql.default_host")),
("$server$username" != "" ? $username : ini_get("mysql.default_user")),
@@ -230,10 +235,10 @@ if (!defined("DRIVER")) {
function connect($server, $username, $password) {
global $adminer;
$options = array();
$options = array(PDO::MYSQL_ATTR_LOCAL_INFILE => false);
$ssl = $adminer->connectSsl();
if ($ssl) {
$options = array(
$options += array(
PDO::MYSQL_ATTR_SSL_KEY => $ssl['key'],
PDO::MYSQL_ATTR_SSL_CERT => $ssl['cert'],
PDO::MYSQL_ATTR_SSL_CA => $ssl['ca'],