From 115a55b8f099d2f2737263e5e93feab53feeb5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Thu, 7 Feb 2008 14:28:10 +0000 Subject: [PATCH] Fix some static references after turning on PHP notice strict logging... git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@260 44740490-163a-0410-bde0-09ae8108e29a --- docs/source/simplesamlphp-sp.xml | 2 +- lib/SimpleSAML/Auth/LDAP.php | 4 ++-- lib/SimpleSAML/Session.php | 10 +++++----- www/auth/login-feide.php | 7 ++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/source/simplesamlphp-sp.xml b/docs/source/simplesamlphp-sp.xml index ad82586a9..35a05fa86 100644 --- a/docs/source/simplesamlphp-sp.xml +++ b/docs/source/simplesamlphp-sp.xml @@ -7,7 +7,7 @@ <articleinfo> <date>2007-10-15</date> - <pubdate>Wed Feb 6 14:26:51 2008</pubdate> + <pubdate>Fri Feb 1 08:44:40 2008</pubdate> <author> <firstname>Andreas Ă…kre</firstname> diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index a159f3e99..d0436b516 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -17,7 +17,7 @@ class SimpleSAML_Auth_LDAP { /** * LDAP link */ - private static $ldap = null; + private $ldap = null; /** @@ -30,7 +30,7 @@ class SimpleSAML_Auth_LDAP { */ public function __construct($hostname) { - if (!isset($this->logger)) $this->logger = new SimpleSAML_Logger(); + if (!isset(self::$logger)) self::$logger = new SimpleSAML_Logger(); $this->ldap = @ldap_connect($hostname); diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 8ad2f0db8..35d9e27ef 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -69,7 +69,7 @@ class SimpleSAML_Session { */ private function __construct($authenticated = true) { - if (!isset($this->logger)) $this->logger = new SimpleSAML_Logger(); + if (!isset(self::$logger)) self::$logger = new SimpleSAML_Logger(); $this->authenticated = $authenticated; if ($authenticated) { @@ -215,7 +215,7 @@ class SimpleSAML_Session { public function getAuthnRequest($protocol, $requestid) { - $this->logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', $requestid, + self::$logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', $requestid, 'Get authnrequest from cache ' . $protocol . ' time:' . time() . ' id: '. $requestid ); $configuration = SimpleSAML_Configuration::getInstance(); @@ -230,7 +230,7 @@ class SimpleSAML_Session { */ if ($cache['date'] < time() - $configuration->getValue('session.requestcache', 4*(60*60)) ) { - $this->logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', $id, + self::$logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', $id, 'Deleting expired authn request with id ' . $id); unset($this->authnrequests[$protocol][$id]); } @@ -258,7 +258,7 @@ class SimpleSAML_Session { */ public function setAuthnRequest($protocol, $requestid, array $cache) { - $this->logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', $requestid, + self::$logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', $requestid, 'Set authnrequest ' . $protocol . ' time:' . time() . ' size:' . count($cache) . ' id: '. $requestid ); $this->dirty = true; @@ -378,7 +378,7 @@ class SimpleSAML_Session { */ public function clean($cleancache = false) { - $this->logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', '-', + self::$logger->log(LOG_DEBUG, $this->getTrackID(), 'Library', 'Session', 'DEBUG', '-', 'Cleaning Session. Clean cache: ' . ($cleancache ? 'yes' : 'no') ); if ($cleancache) { diff --git a/www/auth/login-feide.php b/www/auth/login-feide.php index 394ac3ad9..72a601686 100644 --- a/www/auth/login-feide.php +++ b/www/auth/login-feide.php @@ -103,14 +103,14 @@ if (isset($_REQUEST['username'])) { * Bind as user */ if (!$ldap->bind($dn, $password)) { - $logger->log(LOG_NOTICE, $session->getTrackID(), 'AUTH', 'ldap-feide', 'Fail', $username, $username . ' failed to authenticate. DN=' . $dn); + $logger->log(LOG_NOTICE, $session->getTrackID(), 'AUTH', 'ldap-feide', 'Fail', $requestedUser, $requestedUser . ' failed to authenticate. DN=' . $dn); throw new Exception('Wrong username or password'); } // Retrieve attributes from LDAP $attributes = $ldap->getAttributes($dn, $ldapconfig['attributes']); - $logger->log(LOG_NOTICE, $session->getTrackID(), 'AUTH', 'ldap-feide', 'OK', $username, $username . ' successfully authenticated'); + $logger->log(LOG_NOTICE, $session->getTrackID(), 'AUTH', 'ldap-feide', 'OK', $requestedUser, $requestedUser . ' successfully authenticated'); $session->setAuthenticated(true, 'login-feide'); $session->setAttributes($attributes); @@ -124,7 +124,8 @@ if (isset($_REQUEST['username'])) { } catch (Exception $e) { - $logger->log(LOG_ERR, $session->getTrackID(), 'AUTH', 'ldap-feide', 'ERROR', $username, $e->getMessage()); + $logger->log(LOG_ERR, $session->getTrackID(), 'AUTH', 'ldap-feide', 'ERROR', + (isset($requestedUser) ? $requestedUser : 'na'), $e->getMessage()); $error = $e->getMessage(); } -- GitLab