Handle multiple :p while sanitizing MySQL hosts
Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
This commit is contained in:
parent
337b38044d
commit
6703597772
@ -891,7 +891,7 @@ if (! function_exists('hash_hmac')) {
|
||||
/**
|
||||
* Sanitizes MySQL hostname
|
||||
*
|
||||
* * strips p: prefix
|
||||
* * strips p: prefix(es)
|
||||
*
|
||||
* @param string $name User given hostname
|
||||
*
|
||||
@ -899,8 +899,8 @@ if (! function_exists('hash_hmac')) {
|
||||
*/
|
||||
function PMA_sanitizeMySQLHost($name)
|
||||
{
|
||||
if (strtolower(substr($name, 0, 2)) == 'p:') {
|
||||
return substr($name, 2);
|
||||
while (strtolower(substr($name, 0, 2)) == 'p:') {
|
||||
$name = substr($name, 2);
|
||||
}
|
||||
|
||||
return $name;
|
||||
|
||||
@ -40,6 +40,7 @@ class PMA_sanitizeMySQLHost_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
return array(
|
||||
array('p:foo.bar', 'foo.bar'),
|
||||
array('p:p:foo.bar', 'foo.bar'),
|
||||
array('bar.baz', 'bar.baz'),
|
||||
array('P:example.com', 'example.com'),
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user