From 9f544e69a95b5cf1f990a04f395ac6c15e05550a Mon Sep 17 00:00:00 2001 From: Mads Freek Petersen <freek@wayf.dk> Date: Tue, 29 Apr 2008 13:58:41 +0000 Subject: [PATCH] Added try/catch around connecting to consent database. PDO reveals the database password when an error occurs! git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@530 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Consent/ConsentStorage.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/SimpleSAML/Consent/ConsentStorage.php b/lib/SimpleSAML/Consent/ConsentStorage.php index f92c362fe..fedc765ad 100644 --- a/lib/SimpleSAML/Consent/ConsentStorage.php +++ b/lib/SimpleSAML/Consent/ConsentStorage.php @@ -37,9 +37,13 @@ class SimpleSAML_Consent_Storage { $pdo_user = $config->getValue('consent_pdo_user'); $pdo_passwd = $config->getValue('consent_pdo_passwd'); - $this->dbh = new PDO($pdo_connect, $pdo_user, $pdo_passwd, - array( PDO::ATTR_PERSISTENT => false)); - + try { + $this->dbh = new PDO($pdo_connect, $pdo_user, $pdo_passwd, + array( PDO::ATTR_PERSISTENT => false)); + } catch(Exception $exception) { + $session = SimpleSAML_Session::getInstance(TRUE); + SimpleSAML_Utilities::fatalError($session->getTrackID(), 'PROCESSASSERTION', $exception); + } //$this->dbh->setAttribute('PDO::ATTR_TIMEOUT', 5); } -- GitLab