From ba0219e4039776a724d9d22cf7bec06e0d37e3ab Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Tue, 24 Jan 2006 08:29:33 +0000 Subject: [PATCH] - Patch #21719 by rkerr: made db passwords with special characters work. --- includes/database.mysql.inc | 6 ++++++ includes/database.mysqli.inc | 6 ++++++ includes/database.pgsql.inc | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc index 445a798167c1..8ee51bbe1699 100644 --- a/includes/database.mysql.inc +++ b/includes/database.mysql.inc @@ -32,6 +32,12 @@ function db_connect($url) { $url = parse_url($url); + // Decode url-encoded information in the db connection string + $url['user'] = urldecode($url['user']); + $url['pass'] = urldecode($url['pass']); + $url['host'] = urldecode($url['host']); + $url['path'] = urldecode($url['path']); + // Allow for non-standard MySQL port. if (isset($url['port'])) { $url['host'] = $url['host'] .':'. $url['port']; diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc index 3fba6092f921..372dcc558460 100644 --- a/includes/database.mysqli.inc +++ b/includes/database.mysqli.inc @@ -32,6 +32,12 @@ function db_connect($url) { $url = parse_url($url); + // Decode url-encoded information in the db connection string + $url['user'] = urldecode($url['user']); + $url['pass'] = urldecode($url['pass']); + $url['host'] = urldecode($url['host']); + $url['path'] = urldecode($url['path']); + // Allow for non-standard MySQL port. if (isset($url['port'])) { $url['host'] = $url['host'] .':'. $url['port']; diff --git a/includes/database.pgsql.inc b/includes/database.pgsql.inc index 8375c6366232..1bc2bf27829d 100644 --- a/includes/database.pgsql.inc +++ b/includes/database.pgsql.inc @@ -32,6 +32,12 @@ function db_connect($url) { $url = parse_url($url); + // Decode url-encoded information in the db connection string + $url['user'] = urldecode($url['user']); + $url['pass'] = urldecode($url['pass']); + $url['host'] = urldecode($url['host']); + $url['path'] = urldecode($url['path']); + $conn_string = ' user='. $url['user'] .' dbname='. substr($url['path'], 1) .' password='. $url['pass'] . ' host=' . $url['host']; $conn_string .= isset($url['port']) ? ' port=' . $url['port'] : ''; -- GitLab