in Synchronize, the connection problems detection no longer worked
This commit is contained in:
@@ -46,9 +46,10 @@ function PMA_DBI_real_connect($server, $user, $password, $client_flags, $persist
|
|||||||
* @param string $password mysql user password
|
* @param string $password mysql user password
|
||||||
* @param boolean $is_controluser
|
* @param boolean $is_controluser
|
||||||
* @param array $server host/port/socket/persistant
|
* @param array $server host/port/socket/persistant
|
||||||
|
* @param boolean $auxiliary_connection (if fails, don't go back to login)
|
||||||
* @return mixed false on error or a mysqli object on success
|
* @return mixed false on error or a mysqli object on success
|
||||||
*/
|
*/
|
||||||
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null)
|
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false)
|
||||||
{
|
{
|
||||||
global $cfg, $php_errormsg;
|
global $cfg, $php_errormsg;
|
||||||
|
|
||||||
@@ -93,29 +94,37 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, $password, empty($client_flags) ? NULL : $client_flags);
|
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, $password, empty($client_flags) ? NULL : $client_flags);
|
||||||
|
|
||||||
// Retry with empty password if we're allowed to
|
// Retry with empty password if we're allowed to
|
||||||
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
|
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
|
||||||
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags);
|
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isset($server['host']))
|
if (!isset($server['host'])) {
|
||||||
$link = PMA_DBI_real_connect($server_socket, $user, $password, NULL, $server_persistant);
|
$link = PMA_DBI_real_connect($server_socket, $user, $password, NULL, $server_persistant);
|
||||||
else
|
} else {
|
||||||
$link = PMA_DBI_real_connect($server['host'] . $server_port . $server_socket, $user, $password, NULL, $server_persistant);
|
$link = PMA_DBI_real_connect($server['host'] . $server_port . $server_socket, $user, $password, NULL, $server_persistant);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (empty($link)) {
|
if (empty($link)) {
|
||||||
if ($is_controluser) {
|
if ($is_controluser) {
|
||||||
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
|
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PMA_log_user($user, 'mysql-denied');
|
// we could be calling PMA_DBI_connect() to connect to another
|
||||||
PMA_auth_fails();
|
// server, for example in the Synchronize feature, so do not
|
||||||
|
// go back to main login if it fails
|
||||||
|
if (! $auxiliary_connection) {
|
||||||
|
PMA_log_user($user, 'mysql-denied');
|
||||||
|
PMA_auth_fails();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} // end if
|
} // end if
|
||||||
if (!$server)
|
if (! $server) {
|
||||||
PMA_DBI_postConnect($link, $is_controluser);
|
PMA_DBI_postConnect($link, $is_controluser);
|
||||||
|
}
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,9 +55,10 @@ if (! defined('MYSQLI_TYPE_BIT')) {
|
|||||||
* @param string $password mysql user password
|
* @param string $password mysql user password
|
||||||
* @param boolean $is_controluser
|
* @param boolean $is_controluser
|
||||||
* @param array $server host/port/socket
|
* @param array $server host/port/socket
|
||||||
|
* @param boolean $auxiliary_connection (if fails, don't go back to login)
|
||||||
* @return mixed false on error or a mysqli object on success
|
* @return mixed false on error or a mysqli object on success
|
||||||
*/
|
*/
|
||||||
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null)
|
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false)
|
||||||
{
|
{
|
||||||
if ($server) {
|
if ($server) {
|
||||||
$server_port = (empty($server['port']))
|
$server_port = (empty($server['port']))
|
||||||
@@ -85,7 +86,6 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
|
|||||||
|
|
||||||
// NULL enables connection to the default socket
|
// NULL enables connection to the default socket
|
||||||
|
|
||||||
|
|
||||||
$link = mysqli_init();
|
$link = mysqli_init();
|
||||||
|
|
||||||
mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, true);
|
mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, true);
|
||||||
@@ -114,15 +114,22 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($return_value == false) {
|
if ($return_value == false) {
|
||||||
if ($is_controluser) {
|
if ($is_controluser) {
|
||||||
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
|
trigger_error($GLOBALS['strControluserFailed'], E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PMA_log_user($user, 'mysql-denied');
|
// we could be calling PMA_DBI_connect() to connect to another
|
||||||
PMA_auth_fails();
|
// server, for example in the Synchronize feature, so do not
|
||||||
} // end if
|
// go back to main login if it fails
|
||||||
|
if (! $auxiliary_connection) {
|
||||||
PMA_DBI_postConnect($link, $is_controluser);
|
PMA_log_user($user, 'mysql-denied');
|
||||||
|
PMA_auth_fails();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PMA_DBI_postConnect($link, $is_controluser);
|
||||||
|
}
|
||||||
|
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
@@ -80,20 +80,20 @@ if ((isset($_REQUEST['submit_connect']))) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${"{$con}_connection"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"});
|
${"{$con}_connection"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}, $auxiliary_connection = true);
|
||||||
} // end foreach ($cons as $con)
|
} // end foreach ($cons as $con)
|
||||||
|
|
||||||
if ((! $src_connection && $src_type=='rmt') || (! $trg_connection && $trg_type=='rmt')) {
|
if ((! $src_connection && $src_type == 'rmt') || (! $trg_connection && $trg_type == 'rmt')) {
|
||||||
/**
|
/**
|
||||||
* Displays the connection error string if
|
* Displays the connection error string if
|
||||||
* connections are not established
|
* connections are not established
|
||||||
*/
|
*/
|
||||||
|
|
||||||
echo '<div class="error">' . "\n" ;
|
echo '<div class="error">' . "\n" ;
|
||||||
if(! $src_connection) {
|
if(! $src_connection && $src_type == 'rmt') {
|
||||||
echo $GLOBALS['strCouldNotConnectSource'].'<br />';
|
echo $GLOBALS['strCouldNotConnectSource'].'<br />';
|
||||||
}
|
}
|
||||||
if(! $trg_connection){
|
if(! $trg_connection && $trg_type == 'rmt'){
|
||||||
echo $GLOBALS['strCouldNotConnectTarget'];
|
echo $GLOBALS['strCouldNotConnectTarget'];
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
Reference in New Issue
Block a user