lib/SQL lib/SQL.php

Aleksander Machniak machniak at kolabsys.com
Fri Mar 6 09:58:18 CET 2015


 lib/SQL.php        |    3 ++-
 lib/SQL/oracle.php |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 3f80fd1b8b5f1344391740f142dec5ac6cfbe07d
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Fri Mar 6 03:57:41 2015 -0500

    Do not log database password (#4806)

diff --git a/lib/SQL.php b/lib/SQL.php
index add6fa6..102f59d 100644
--- a/lib/SQL.php
+++ b/lib/SQL.php
@@ -105,7 +105,8 @@ class SQL
     protected function connect()
     {
         if (!$this->conn && !$this->conn_tried) {
-            Log::debug("SQL: Connecting to " . $this->sql_uri);
+            $passwd_regex = '|^([a-zA-Z0-9]+://[^:]+:)[^@]+|';
+            Log::debug("SQL: Connecting to " . preg_replace($passwd_regex, '\\1***', $this->sql_uri));
 
             $this->conn_tried = true;
 
diff --git a/lib/SQL/oracle.php b/lib/SQL/oracle.php
index 4bc072c..9296474 100644
--- a/lib/SQL/oracle.php
+++ b/lib/SQL/oracle.php
@@ -36,7 +36,8 @@ class SQL_oracle extends SQL
     protected function connect()
     {
         if (!$this->conn && !$this->conn_tried) {
-            Log::debug("SQL: Connecting to " . $this->sql_uri);
+            $passwd_regex = '|^([a-zA-Z0-9]+://[^:]+:)[^@]+|';
+            Log::debug("SQL: Connecting to " . preg_replace($passwd_regex, '\\1***', $this->sql_uri));
 
             $this->conn_tried = true;
 




More information about the commits mailing list