From 83ba16e6c0ec3c989eab0a81fcda06978ddef8a1 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Wed, 15 Jul 2009 10:40:37 -0400 Subject: [PATCH] throw Horde_Auth_Exceptions instead of generic Horde_Exceptions --- framework/Auth/lib/Horde/Auth.php | 12 ++++---- framework/Auth/lib/Horde/Auth/Application.php | 16 +++++----- framework/Auth/lib/Horde/Auth/Auto.php | 6 ++-- framework/Auth/lib/Horde/Auth/Base.php | 36 +++++++++++----------- framework/Auth/lib/Horde/Auth/Composite.php | 12 ++++---- framework/Auth/lib/Horde/Auth/Customsql.php | 32 +++++++++---------- framework/Auth/lib/Horde/Auth/Cyrsql.php | 40 ++++++++++++------------ framework/Auth/lib/Horde/Auth/Cyrus.php | 18 +++++------ framework/Auth/lib/Horde/Auth/Exception.php | 16 ++++++++++ framework/Auth/lib/Horde/Auth/Ftp.php | 8 ++--- framework/Auth/lib/Horde/Auth/Http.php | 10 +++--- framework/Auth/lib/Horde/Auth/Http/Remote.php | 4 +-- framework/Auth/lib/Horde/Auth/Imap.php | 16 +++++----- framework/Auth/lib/Horde/Auth/Imsp.php | 4 +-- framework/Auth/lib/Horde/Auth/Ipbasic.php | 6 ++-- framework/Auth/lib/Horde/Auth/Kolab.php | 22 +++++++------- framework/Auth/lib/Horde/Auth/Krb5.php | 14 ++++----- framework/Auth/lib/Horde/Auth/Ldap.php | 44 +++++++++++++-------------- framework/Auth/lib/Horde/Auth/Login.php | 6 ++-- framework/Auth/lib/Horde/Auth/Msad.php | 20 ++++++------ framework/Auth/lib/Horde/Auth/Pam.php | 10 +++--- framework/Auth/lib/Horde/Auth/Passwd.php | 42 ++++++++++++------------- framework/Auth/lib/Horde/Auth/Peclsasl.php | 12 ++++---- framework/Auth/lib/Horde/Auth/Radius.php | 18 +++++------ framework/Auth/lib/Horde/Auth/Shibboleth.php | 4 +-- framework/Auth/lib/Horde/Auth/Smb.php | 12 ++++---- framework/Auth/lib/Horde/Auth/Smbclient.php | 8 ++--- framework/Auth/lib/Horde/Auth/Sql.php | 40 ++++++++++++------------ framework/Auth/package.xml | 2 ++ 29 files changed, 254 insertions(+), 236 deletions(-) create mode 100644 framework/Auth/lib/Horde/Auth/Exception.php diff --git a/framework/Auth/lib/Horde/Auth.php b/framework/Auth/lib/Horde/Auth.php index 290f2bc8f..8ac3d7571 100644 --- a/framework/Auth/lib/Horde/Auth.php +++ b/framework/Auth/lib/Horde/Auth.php @@ -77,7 +77,7 @@ class Horde_Auth * parameters a subclass might need. * * @return Horde_Auth_Base The newly created concrete instance. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ static public function factory($driver, $params = null) { @@ -91,7 +91,7 @@ class Horde_Auth return new $class($params); } - throw new Horde_Exception('Class definition of ' . $class . ' not found.'); + throw new Horde_Auth_Exception('Class definition of ' . $class . ' not found.'); } /** @@ -107,7 +107,7 @@ class Horde_Auth * connection parameters a subclass might need. * * @return Horde_Auth_Base The concrete reference. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ static public function singleton($driver, $params = array()) { @@ -307,7 +307,7 @@ class Horde_Auth * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ static public function removeUserData($userId) { @@ -316,14 +316,14 @@ class Horde_Auth foreach ($GLOBALS['registry']->listApps(array('notoolbar', 'hidden', 'active', 'admin')) as $app) { try { $GLOBALS['registry']->callByPackage($app, 'removeUserData', array($userId)); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR); $errApps[] = $app; } } if (count($errApps)) { - throw new Horde_Exception(sprintf(_("The following applications encountered errors removing user data: %s"), implode(', ', $errApps))); + throw new Horde_Auth_Exception(sprintf(_("The following applications encountered errors removing user data: %s"), implode(', ', $errApps))); } } diff --git a/framework/Auth/lib/Horde/Auth/Application.php b/framework/Auth/lib/Horde/Auth/Application.php index bf3d69d2e..9818abbaf 100644 --- a/framework/Auth/lib/Horde/Auth/Application.php +++ b/framework/Auth/lib/Horde/Auth/Application.php @@ -86,20 +86,20 @@ class Horde_Auth_Application extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (!$this->hasCapability('authenticate')) { - throw new Horde_Exception($this->_params['app'] . ' does not provide an authenticate() method.'); + throw new Horde_Auth_Exception($this->_params['app'] . ' does not provide an authenticate() method.'); } $registry = Horde_Registry::singleton(); try { $result = $registry->callByPackage($this->_params['app'], 'authenticate', array($userId, $credentials, $this->_params['params'])); - } catch (Horde_Exception $e) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + } catch (Horde_Auth_Exception $e) { + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } // Horrific hack. Avert your eyes. Since an application may already @@ -134,7 +134,7 @@ class Horde_Auth_Application extends Horde_Auth_Base * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -169,7 +169,7 @@ class Horde_Auth_Application extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -188,7 +188,7 @@ class Horde_Auth_Application extends Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { @@ -205,7 +205,7 @@ class Horde_Auth_Application extends Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { diff --git a/framework/Auth/lib/Horde/Auth/Auto.php b/framework/Auth/lib/Horde/Auth/Auto.php index d9120d479..d10d35a24 100644 --- a/framework/Auth/lib/Horde/Auth/Auto.php +++ b/framework/Auth/lib/Horde/Auth/Auto.php @@ -51,18 +51,18 @@ class Horde_Auth_Auto extends Horde_Auth_Base } /** - * Horde_Exception should pass a message string (if any) in the message + * Horde_Auth_Exception should pass a message string (if any) in the message * field, and the REASON_* constant in the code field (defaults to * REASON_MESSAGE). * * @param string $userID The userID to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { - throw new Horde_Exception('unsupported'); + throw new Horde_Auth_Exception('unsupported'); } /** diff --git a/framework/Auth/lib/Horde/Auth/Base.php b/framework/Auth/lib/Horde/Auth/Base.php index dd20cd662..bb08e0a2e 100644 --- a/framework/Auth/lib/Horde/Auth/Base.php +++ b/framework/Auth/lib/Horde/Auth/Base.php @@ -110,7 +110,7 @@ abstract class Horde_Auth_Base $auth = true; } } - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_DEBUG); Horde_Auth::setAuthError($e->getCode() || Horde_Auth::REASON_MESSAGE, $e->getMessage()); } @@ -121,14 +121,14 @@ abstract class Horde_Auth_Base /** * Authentication stub. * - * Horde_Exception should pass a message string (if any) in the message + * Horde_Auth_Exception should pass a message string (if any) in the message * field, and the REASON_* constant in the code field (defaults to * REASON_MESSAGE). * * @param string $userID The userID to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ abstract protected function _authenticate($userId, $credentials); @@ -138,11 +138,11 @@ abstract class Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { - throw new Horde_Exception('unsupported'); + throw new Horde_Auth_Exception('unsupported'); } /** @@ -152,11 +152,11 @@ abstract class Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { - throw new Horde_Exception('unsupported'); + throw new Horde_Auth_Exception('unsupported'); } /** @@ -164,22 +164,22 @@ abstract class Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { - throw new Horde_Exception('unsupported'); + throw new Horde_Auth_Exception('unsupported'); } /** * Lists all users in the system. * * @return mixed The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { - throw new Horde_Exception('unsupported'); + throw new Horde_Auth_Exception('unsupported'); } /** @@ -194,7 +194,7 @@ abstract class Horde_Auth_Base try { $users = $this->listUsers(); return in_array($userId, $users); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { return false; } } @@ -209,7 +209,7 @@ abstract class Horde_Auth_Base { try { return $this->_transparent(); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { Horde_Auth::setAuthError($e->getCode() || Horde_Auth::REASON_MESSAGE, $e->getMessage()); return false; } @@ -218,14 +218,14 @@ abstract class Horde_Auth_Base /** * Transparent authentication stub. * - * If the auth error message is desired to be set, Horde_Exception should + * If the auth error message is desired to be set, Horde_Auth_Exception should * thrown instead of returning false. - * The Horde_Exception object should have a message string (if any) in the + * The Horde_Auth_Exception object should have a message string (if any) in the * message field, and the REASON_* constant in the code field (defaults to * REASON_MESSAGE). * * @return boolean Whether transparent login is supported. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _transparent() { @@ -239,11 +239,11 @@ abstract class Horde_Auth_Base * @param string $userId The user id for which to reset the password. * * @return string The new password on success. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function resetPassword($userId) { - throw new Horde_Exception('unsupported'); + throw new Horde_Auth_Exception('unsupported'); } /** diff --git a/framework/Auth/lib/Horde/Auth/Composite.php b/framework/Auth/lib/Horde/Auth/Composite.php index 5d6255639..dbb1306f2 100644 --- a/framework/Auth/lib/Horde/Auth/Composite.php +++ b/framework/Auth/lib/Horde/Auth/Composite.php @@ -44,7 +44,7 @@ class Horde_Auth_Composite extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { @@ -60,7 +60,7 @@ class Horde_Auth_Composite extends Horde_Auth_Base return; } - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } /** @@ -139,7 +139,7 @@ class Horde_Auth_Composite extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -158,7 +158,7 @@ class Horde_Auth_Composite extends Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { @@ -175,7 +175,7 @@ class Horde_Auth_Composite extends Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { @@ -191,7 +191,7 @@ class Horde_Auth_Composite extends Horde_Auth_Base * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { diff --git a/framework/Auth/lib/Horde/Auth/Customsql.php b/framework/Auth/lib/Horde/Auth/Customsql.php index 243e92e81..ca1ed8b99 100644 --- a/framework/Auth/lib/Horde/Auth/Customsql.php +++ b/framework/Auth/lib/Horde/Auth/Customsql.php @@ -74,14 +74,14 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql * @param string $userId The userId to check. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { try { $this->_connect(); - } catch (Horde_Exception $e) { - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + } catch (Horde_Auth_Exception $e) { + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } /* Build a custom query, based on the config file. */ @@ -95,7 +95,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql $result = $this->_db->query($query); if ($result instanceof PEAR_Error) { - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } $row = $result->fetchRow(DB_GETMODE_ASSOC); @@ -107,7 +107,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql } $result->free(); - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } /** @@ -116,7 +116,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql * @param string $userId The userId to add. * @param array $credentials The credentials to add. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -132,7 +132,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql $result = $this->_db->query($query); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } } @@ -143,7 +143,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql * @param string $newId The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ function updateUser($oldId, $newId, $credentials) { @@ -161,7 +161,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql $result = $this->_db->query($query); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } } @@ -172,7 +172,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql * @param string $userId The user id for which to reset the password. * * @return string The new password on success. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function resetPassword($userId) { @@ -191,7 +191,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql $result = $this->_db->query($query); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } return $password; @@ -202,7 +202,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { @@ -214,7 +214,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql $result = $this->_db->query($query); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } $this->removeUserData($userId); @@ -224,7 +224,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -236,7 +236,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql $result = $this->_db->getAll($query, null, DB_FETCHMODE_ORDERED); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } /* Loop through and build return array. */ @@ -257,7 +257,7 @@ class Horde_Auth_Customsql extends Horde_Auth_Sql { try { $this->_connect(); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { return false; } diff --git a/framework/Auth/lib/Horde/Auth/Cyrsql.php b/framework/Auth/lib/Horde/Auth/Cyrsql.php index 87874f136..4d30aff47 100644 --- a/framework/Auth/lib/Horde/Auth/Cyrsql.php +++ b/framework/Auth/lib/Horde/Auth/Cyrsql.php @@ -160,15 +160,15 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql * @param string $userId The userId to check. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { try { $this->_connect(); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } if (!empty($this->_params['domain_field']) && @@ -192,26 +192,26 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql $result = $this->_db->query($query, $values); if ($result instanceof PEAR_Error) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } $row = $result->fetchRow(DB_GETMODE_ASSOC); if (is_array($row)) { $result->free(); } else { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } if (!$this->_comparePasswords($row[$this->_params['password_field']], $credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $now = time(); if (!empty($this->_params['hard_expiration_field']) && !empty($row[$this->_params['hard_expiration_field']]) && ($now > $row[$this->_params['hard_expiration_field']])) { - throw new Horde_Exception('', Horde_Auth::REASON_EXPIRED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_EXPIRED); } if (!empty($this->_params['soft_expiration_field']) && @@ -227,7 +227,7 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql * @param string $userId The userId to add. * @param array $credentials The credentials to add. * - * @throw Horde_Exception + * @throw Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -259,7 +259,7 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql $dbresult2 = $this->_db->query($query, $values); if ($dbresult2 instanceof PEAR_Error) { - throw new Horde_Exception($dbresult2); + throw new Horde_Auth_Exception($dbresult2); } } else { parent::addUser($userId, $credentials); @@ -270,7 +270,7 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql $ob->createMailbox($mailbox); $ob->setACL($mailbox, $this->_params['cyradm'], 'lrswipcda'); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } foreach ($this->_params['folders'] as $folders) { @@ -293,14 +293,14 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom try { $this->_ob->setQuota($mailbox, array('storage' => $this->_params['quota'])); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } } if (isset($this->_params['quota']) && ($this->_params['quota'] >= 0) && !@imap_set_quota($this->_imapStream, 'user' . $this->_separator . $userId, $this->_params['quota'])) { - throw new Horde_Exception(sprintf(_("IMAP mailbox quota creation failed: %s"), imap_last_error())); + throw new Horde_Auth_Exception(sprintf(_("IMAP mailbox quota creation failed: %s"), imap_last_error())); } } @@ -309,7 +309,7 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ function removeUser($userId) { @@ -348,7 +348,7 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom $this->_ob->setACL($mailbox, $admin, array('rights' => 'lrswipcda')); $this->_ob->deleteMailbox($mailbox); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } Horde_Auth::removeUserData($userId); @@ -358,7 +358,7 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom * List all users in the system. * * @return mixed The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -384,7 +384,7 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom $result = $this->_db->getAll($query, null, DB_FETCHMODE_ORDERED); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } /* Loop through and build return array. */ @@ -414,7 +414,7 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { @@ -451,14 +451,14 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom $res = $this->_db->query($query, $values); if ($res instanceof PEAR_Error) { - throw new Horde_Exception($res); + throw new Horde_Auth_Exception($res); } } /** * Attempts to open connections to the SQL and IMAP servers. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _connect() { @@ -488,7 +488,7 @@ Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $dom $this->_ob = Horde_Imap_Client::getInstance('Socket', $imap_config); $this->_ob->login(); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } $this->_connected = true; diff --git a/framework/Auth/lib/Horde/Auth/Cyrus.php b/framework/Auth/lib/Horde/Auth/Cyrus.php index 3ce2227ad..fd7ec5cc7 100644 --- a/framework/Auth/lib/Horde/Auth/Cyrus.php +++ b/framework/Auth/lib/Horde/Auth/Cyrus.php @@ -150,7 +150,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to add. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -163,7 +163,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base try { $this->_ob->createMailbox($mailbox); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } if (isset($this->_params['folders']) && @@ -180,7 +180,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base try { $this->_ob->setQuota($mailbox, array('storage' => $this->_params['quota'])); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } } } @@ -190,7 +190,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { @@ -207,7 +207,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base $this->_ob->setACL($mailbox, $admin, array('rights' => 'lrswipcda')); $this->_ob->deleteMailbox($mailbox); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } Horde_Auth::removeUserData($userId); @@ -216,7 +216,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base /** * Attempts to open connections to the IMAP servers. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _connect() { @@ -236,7 +236,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base $this->_ob = Horde_Imap_Client::getInstance('Socket', $imap_config); $this->_ob->login(); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } } @@ -244,7 +244,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -258,7 +258,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { diff --git a/framework/Auth/lib/Horde/Auth/Exception.php b/framework/Auth/lib/Horde/Auth/Exception.php new file mode 100644 index 000000000..ab33e1d15 --- /dev/null +++ b/framework/Auth/lib/Horde/Auth/Exception.php @@ -0,0 +1,16 @@ + + * @author Michael Slusarz + * @package Horde_Auth + */ +class Horde_Auth_Exception extends Horde_Exception +{ +} diff --git a/framework/Auth/lib/Horde/Auth/Ftp.php b/framework/Auth/lib/Horde/Auth/Ftp.php index d35e7946b..ed2bfcea5 100644 --- a/framework/Auth/lib/Horde/Auth/Ftp.php +++ b/framework/Auth/lib/Horde/Auth/Ftp.php @@ -27,12 +27,12 @@ class Horde_Auth_Ftp extends Horde_Auth_Base * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('ftp')) { - throw new Horde_Exception('Horde_Auth_Ftp: Required FTP extension not found. Compile PHP with the --enable-ftp switch.'); + throw new Horde_Auth_Exception('Horde_Auth_Ftp: Required FTP extension not found. Compile PHP with the --enable-ftp switch.'); } $params = array_merge(array( @@ -50,7 +50,7 @@ class Horde_Auth_Ftp extends Horde_Auth_Base * @param array $credentials An array of login credentials. For FTP, * this must contain a password entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { @@ -60,7 +60,7 @@ class Horde_Auth_Ftp extends Horde_Auth_Base @ftp_quit($ftp); if ($res) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } diff --git a/framework/Auth/lib/Horde/Auth/Http.php b/framework/Auth/lib/Horde/Auth/Http.php index f5a8508b7..cbe7b1d1c 100644 --- a/framework/Auth/lib/Horde/Auth/Http.php +++ b/framework/Auth/lib/Horde/Auth/Http.php @@ -75,19 +75,19 @@ class Horde_Auth_Http extends Horde_Auth_Base * @param array $credentials An array of login credentials. For IMAP, * this must contain a password entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (empty($credentials['password']) || empty($this->_users[$userId])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $hash = Horde_Auth::getCryptedPassword($credentials['password'], $this->_users[$userId], $this->_params['encryption'], !empty($this->_params['show_encryption'])); if ($hash != $this->_users[$userId]) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } @@ -125,7 +125,7 @@ class Horde_Auth_Http extends Horde_Auth_Base * authentication info present. * * @return boolean Whether or not the client is allowed. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _transparent() { @@ -134,7 +134,7 @@ class Horde_Auth_Http extends Horde_Auth_Base return Horde_Auth::setAuth(Horde_Util::dispelMagicQuotes($_SERVER['PHP_AUTH_USER']), array('password' => Horde_Util::dispelMagicQuotes($_SERVER['PHP_AUTH_PW']), 'transparent' => 1)); } - throw new Horde_Exception(_("HTTP Authentication not found.")); + throw new Horde_Auth_Exception(_("HTTP Authentication not found.")); } } diff --git a/framework/Auth/lib/Horde/Auth/Http/Remote.php b/framework/Auth/lib/Horde/Auth/Http/Remote.php index 6391fb54c..1852e2d90 100644 --- a/framework/Auth/lib/Horde/Auth/Http/Remote.php +++ b/framework/Auth/lib/Horde/Auth/Http/Remote.php @@ -19,7 +19,7 @@ class Horde_Auth_Http_Remote extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { @@ -39,7 +39,7 @@ class Horde_Auth_Http_Remote extends Horde_Auth_Base $request->sendRequest(); if ($request->getResponseCode() != 200) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } diff --git a/framework/Auth/lib/Horde/Auth/Imap.php b/framework/Auth/lib/Horde/Auth/Imap.php index 6571e1315..6769a6d31 100644 --- a/framework/Auth/lib/Horde/Auth/Imap.php +++ b/framework/Auth/lib/Horde/Auth/Imap.php @@ -71,7 +71,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base * @param array $credentials An array of login credentials. For IMAP, * this must contain a password entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { @@ -80,7 +80,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base $ob->login(); $ob->logout(); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } @@ -90,7 +90,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -100,7 +100,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base $ob->createMailbox($mailbox); $ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda'); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } } @@ -109,7 +109,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { @@ -118,7 +118,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base $ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda'); $ob->deleteMailbox(Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap')); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } Horde_Auth::removeUserData($userId); @@ -128,7 +128,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -136,7 +136,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base $ob->_getOb($this->_params['admin_user'], $this->_params['admin_password']); $list = $ob->listMailboxes($this->_params['userhierarchy'] . '%', Horde_Imap_Client::MBOX_ALL, array('flat' => true)); } catch (Horde_Imap_Client_Exception $e) { - throw new Horde_Exception($e); + throw new Horde_Auth_Exception($e); } return empty($list) diff --git a/framework/Auth/lib/Horde/Auth/Imsp.php b/framework/Auth/lib/Horde/Auth/Imsp.php index ee0d058bf..f008e825b 100644 --- a/framework/Auth/lib/Horde/Auth/Imsp.php +++ b/framework/Auth/lib/Horde/Auth/Imsp.php @@ -30,12 +30,12 @@ class Horde_Auth_imsp extends Horde_Auth_Base $imsp = Net_IMSP_Auth::singleton($this->_params['auth_method']); if ($imsp instanceof PEAR_Error) { - throw new Horde_Exception($imsp->getMessage()); + throw new Horde_Auth_Exception($imsp->getMessage()); } $result = $imsp->authenticate($this->_params, false); if ($result instanceof PEAR_Error) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } diff --git a/framework/Auth/lib/Horde/Auth/Ipbasic.php b/framework/Auth/lib/Horde/Auth/Ipbasic.php index 1e89f22b8..e4e46a111 100644 --- a/framework/Auth/lib/Horde/Auth/Ipbasic.php +++ b/framework/Auth/lib/Horde/Auth/Ipbasic.php @@ -51,12 +51,12 @@ class Horde_Auth_Ipbasic extends Horde_Auth_Base * block. * * @return boolean Whether or not the client is allowed. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _transparent() { if (!isset($_SERVER['REMOTE_ADDR'])) { - throw new Horde_Exception(_("IP Address not avaialble.")); + throw new Horde_Auth_Exception(_("IP Address not avaialble.")); } $client = $_SERVER['REMOTE_ADDR']; @@ -66,7 +66,7 @@ class Horde_Auth_Ipbasic extends Horde_Auth_Base } } - throw new Horde_Exception(_("IP Address not within allowed CIDR block.")); + throw new Horde_Auth_Exception(_("IP Address not within allowed CIDR block.")); } /** diff --git a/framework/Auth/lib/Horde/Auth/Kolab.php b/framework/Auth/lib/Horde/Auth/Kolab.php index f96c92539..34ee5df80 100644 --- a/framework/Auth/lib/Horde/Auth/Kolab.php +++ b/framework/Auth/lib/Horde/Auth/Kolab.php @@ -39,7 +39,7 @@ class Horde_Auth_Kolab extends Horde_Auth_Base * @param array $credentials An array of login credentials. For Kolab, * this must contain a "password" entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { @@ -51,13 +51,13 @@ class Horde_Auth_Kolab extends Horde_Auth_Base try { $session = Horde_Kolab_Session::singleton($userId, $credentials, true); } catch (Horde_Kolab_Server_MissingObjectException $e) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } catch (Exception $e) { Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } } else { - throw new Horde_Exception('The class Horde_Kolab_Session is required for the Kolab auth driver but it is missing!', Horde_Auth::REASON_MESSAGE); + throw new Horde_Auth_Exception('The class Horde_Kolab_Session is required for the Kolab auth driver but it is missing!', Horde_Auth::REASON_MESSAGE); } if (!isset($conf['auth']['params']) || @@ -113,10 +113,10 @@ class Horde_Auth_Kolab extends Horde_Auth_Base 'history_list' => $new_history_list), true); if ($count > $max_count) { - throw new Horde_Exception(_("Too many invalid logins during the last minutes.")); + throw new Horde_Auth_Exception(_("Too many invalid logins during the last minutes.")); } - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } @@ -153,12 +153,12 @@ class Horde_Auth_Kolab extends Horde_Auth_Base * List Users * * @return array List of Users - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { if (!class_exists('Horde_Kolab_Session')) { - throw new Horde_Exception('The Horde_Kolab_Session class is not available.'); + throw new Horde_Auth_Exception('The Horde_Kolab_Session class is not available.'); } $session = Horde_Kolab_Session::singleton(); @@ -180,12 +180,12 @@ class Horde_Auth_Kolab extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to be set. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { if (!class_exists('Horde_Kolab_Session')) { - throw new Horde_Exception('The Horde_Kolab_Session class is not available.'); + throw new Horde_Auth_Exception('The Horde_Kolab_Session class is not available.'); } $session = Horde_Kolab_Session::singleton(); @@ -201,7 +201,7 @@ class Horde_Auth_Kolab extends Horde_Auth_Base } else if ($result instanceof PEAR_Error) { return $result; } else { - throw new Horde_Exception(sprintf('The new Kolab object is a %s rather than a ' . KOLAB_OBJECT_USER, get_class($result))); + throw new Horde_Auth_Exception(sprintf('The new Kolab object is a %s rather than a ' . KOLAB_OBJECT_USER, get_class($result))); } } diff --git a/framework/Auth/lib/Horde/Auth/Krb5.php b/framework/Auth/lib/Horde/Auth/Krb5.php index ebf7f72a4..e6602bd4b 100644 --- a/framework/Auth/lib/Horde/Auth/Krb5.php +++ b/framework/Auth/lib/Horde/Auth/Krb5.php @@ -25,12 +25,12 @@ class Horde_Auth_Krb5 extends Horde_Auth_Base * * @param array $params Not used. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('krb5')) { - throw new Horde_Exception(_("Horde_Auth_Krb5: Required krb5 extension not found.")); + throw new Horde_Auth_Exception(_("Horde_Auth_Krb5: Required krb5 extension not found.")); } parent::__construct($params); @@ -44,12 +44,12 @@ class Horde_Auth_Krb5 extends Horde_Auth_Base * For kerberos, this must contain a password * entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $result = krb5_login($userId, $credentials['password']); @@ -59,13 +59,13 @@ class Horde_Auth_Krb5 extends Horde_Auth_Base return; case KRB5_BAD_PASSWORD: - throw new Horde_Exception(_("Bad kerberos password.")); + throw new Horde_Auth_Exception(_("Bad kerberos password.")); case KRB5_BAD_USER: - throw new Horde_Exception(_("Bad kerberos username.")); + throw new Horde_Auth_Exception(_("Bad kerberos username.")); default: - throw new Horde_Exception(_("Kerberos server rejected authentication.")); + throw new Horde_Auth_Exception(_("Kerberos server rejected authentication.")); } } diff --git a/framework/Auth/lib/Horde/Auth/Ldap.php b/framework/Auth/lib/Horde/Auth/Ldap.php index c5dd4fb99..c29fcdc55 100644 --- a/framework/Auth/lib/Horde/Auth/Ldap.php +++ b/framework/Auth/lib/Horde/Auth/Ldap.php @@ -57,12 +57,12 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('ldap')) { - throw new Horde_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found.")); + throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found.")); } /* Ensure we've been provided with all of the necessary parameters. */ @@ -76,14 +76,14 @@ class Horde_Auth_Ldap extends Horde_Auth_Base /** * Does an ldap connect and binds as the guest user or as the optional dn. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _connect() { /* Connect to the LDAP server. */ $this->_ds = @ldap_connect($this->_params['hostspec']); if (!$this->_ds) { - throw new Horde_Exception(_("Failed to connect to LDAP server.")); + throw new Horde_Auth_Exception(_("Failed to connect to LDAP server.")); } if (isset($this->_params['version'])) { @@ -125,7 +125,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base : @ldap_bind($this->_ds); if (!$bind) { - throw new Horde_Exception(_("Could not bind to LDAP server.")); + throw new Horde_Auth_Exception(_("Could not bind to LDAP server.")); } } @@ -135,7 +135,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * @param string $userId The userId to find. * * @return string The users full DN - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _findDN($userId) { @@ -152,14 +152,14 @@ class Horde_Auth_Ldap extends Horde_Auth_Base array($this->_params['uid'])); if (!$search) { Horde::logMessage(ldap_error($this->_ds), __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception(_("Could not search the LDAP server.")); + throw new Horde_Auth_Exception(_("Could not search the LDAP server.")); } $result = @ldap_get_entries($this->_ds, $search); if (is_array($result) && (count($result) > 1)) { $dn = $result[0]['dn']; } else { - throw new Horde_Exception(_("Empty result.")); + throw new Horde_Auth_Exception(_("Empty result.")); } return $dn; @@ -263,7 +263,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { @@ -277,7 +277,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base $bind = @ldap_bind($this->_ds, $dn, $credentials['password']); if ($bind == false) { @ldap_close($this->_ds); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } if ($this->_params['password_expiration'] == 'yes') { @@ -297,7 +297,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base if ($toexpire == 0) { $this->_authCredentials['changeRequested'] = true; } elseif ($toexpire < 0) { - throw new Horde_Exception('', Horde_Auth::REASON_EXPIRED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_EXPIRED); } } } @@ -311,12 +311,12 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to be set. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { if ($this->_params['ad']) { - throw new Horde_Exception(_("Horde_Auth_Ldap: Adding users is not supported for Active Directory")); + throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Adding users is not supported for Active Directory")); } /* Connect to the LDAP server. */ @@ -353,7 +353,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base $result = @ldap_add($this->_ds, $dn, $entry); if (!$result) { - throw new Horde_Exception(sprintf(_("Horde_Auth_Ldap: Unable to add user \"%s\". This is what the server said: "), $userId) . @ldap_error($this->_ds)); + throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Ldap: Unable to add user \"%s\". This is what the server said: "), $userId) . @ldap_error($this->_ds)); } @ldap_close($this->_ds); @@ -364,12 +364,12 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * * @param string $userId The userId to add. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { if ($this->_params['ad']) { - throw new Horde_Exception(_("Horde_Auth_Ldap: Removing users is not supported for Active Directory")); + throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Removing users is not supported for Active Directory")); } /* Connect to the LDAP server. */ @@ -385,7 +385,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base $result = @ldap_delete($this->_ds, $dn); if (!$result) { - throw new Horde_Exception(sprintf(_("Auth_ldap: Unable to remove user \"%s\""), $userId)); + throw new Horde_Auth_Exception(sprintf(_("Auth_ldap: Unable to remove user \"%s\""), $userId)); } @ldap_close($this->_ds); @@ -400,12 +400,12 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { if ($this->_params['ad']) { - throw new Horde_Exception(_("Horde_Auth_Ldap: Updating users is not supported for Active Directory.")); + throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Updating users is not supported for Active Directory.")); } /* Connect to the LDAP server. */ @@ -430,7 +430,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base if ($shadow['shadowlastchange'] && $shadow['shadowmin'] && ($shadow['shadowlastchange'] + $shadow['shadowmin'] > (time() / 86400))) { - throw new Horde_Exception(_("Minimum password age has not yet expired")); + throw new Horde_Auth_Exception(_("Minimum password age has not yet expired")); } /* Set the lastchange field */ @@ -490,7 +490,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base } if (!$result) { - throw new Horde_Exception(sprintf(_("Horde_Auth_Ldap: Unable to update user \"%s\""), $newID)); + throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Ldap: Unable to update user \"%s\""), $newID)); } @ldap_close($this->_ds); @@ -500,7 +500,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base * List Users * * @return array List of Users - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { diff --git a/framework/Auth/lib/Horde/Auth/Login.php b/framework/Auth/lib/Horde/Auth/Login.php index 2549cc58e..e02ddfbcd 100644 --- a/framework/Auth/lib/Horde/Auth/Login.php +++ b/framework/Auth/lib/Horde/Auth/Login.php @@ -59,17 +59,17 @@ class Horde_Auth_Login extends Horde_Auth_Base protected function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $proc = @popen($this->_location . ' -c /bin/true ' . $userId, 'w'); if (!is_resource($proc)) { - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } fwrite($proc, $credentials['password']); if (@pclose($proc) !== 0) { - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } } diff --git a/framework/Auth/lib/Horde/Auth/Msad.php b/framework/Auth/lib/Horde/Auth/Msad.php index f46a5ea93..327af681d 100644 --- a/framework/Auth/lib/Horde/Auth/Msad.php +++ b/framework/Auth/lib/Horde/Auth/Msad.php @@ -22,12 +22,12 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('ldap')) { - throw new Horde_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found.")); + throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found.")); } $params = array_merge(array( @@ -69,7 +69,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap * @param string $accountName The user sAMAccountName to find. * @param array $credentials The credentials to be set. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($accountName, $credentials) { @@ -114,7 +114,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap $success = @ldap_add($this->_ds, $dn, $entry); if (!$success) { - throw new Horde_Exception(sprintf(_("Auth_msad: Unable to add user \"%s\". This is what the server said: "), $accountName) . ldap_error($this->_ds)); + throw new Horde_Auth_Exception(sprintf(_("Auth_msad: Unable to add user \"%s\". This is what the server said: "), $accountName) . ldap_error($this->_ds)); } @ldap_close($this->_ds); @@ -125,7 +125,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap * * @param string $accountName The user sAMAccountName to remove. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($accountName) { @@ -139,7 +139,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap : $entry['dn']; if (!@ldap_delete($this->_ds, $dn)) { - throw new Horde_Exception(sprintf(_("Horde_Auth_Msad: Unable to remove user \"%s\""), $accountName)); + throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Msad: Unable to remove user \"%s\""), $accountName)); } @ldap_close($this->_ds); @@ -154,7 +154,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldId, $newId, $credentials) { @@ -186,7 +186,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap } if (!$success) { - throw new Horde_Exception(sprintf(_("Horde_Auth_Msad: Unable to update user \"%s\""), $newID), __FILE__, __LINE__); + throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Msad: Unable to update user \"%s\""), $newID), __FILE__, __LINE__); } @ldap_close($this->_ds); @@ -199,7 +199,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap * @param string $user_id The user id for which to reset the password. * * @return string The new password on success. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function resetPassword($user_id) { @@ -212,7 +212,7 @@ class Horde_Auth_Msad extends Horde_Auth_Ldap /** * Does an ldap connect and binds as the guest user. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _connect() { diff --git a/framework/Auth/lib/Horde/Auth/Pam.php b/framework/Auth/lib/Horde/Auth/Pam.php index 7dba7fd5b..f1d7ae92a 100644 --- a/framework/Auth/lib/Horde/Auth/Pam.php +++ b/framework/Auth/lib/Horde/Auth/Pam.php @@ -33,12 +33,12 @@ class Horde_Auth_Pam extends Horde_Auth_Base * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('pam')) { - throw new Horde_Exception(_("PAM authentication is not available.")); + throw new Horde_Auth_Exception(_("PAM authentication is not available.")); } if (!empty($params['service'])) { @@ -54,17 +54,17 @@ class Horde_Auth_Pam extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $error = null; if (!pam_auth($userId, $credentials['password'], $error)) { - throw new Horde_Exception($error); + throw new Horde_Auth_Exception($error); } } diff --git a/framework/Auth/lib/Horde/Auth/Passwd.php b/framework/Auth/lib/Horde/Auth/Passwd.php index 34971a6de..14dca9f5f 100644 --- a/framework/Auth/lib/Horde/Auth/Passwd.php +++ b/framework/Auth/lib/Horde/Auth/Passwd.php @@ -149,7 +149,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base /** * Read and, if requested, lock the password file. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _read() { @@ -158,7 +158,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base } if (empty($this->_params['filename'])) { - throw new Horde_Exception('No password file set.'); + throw new Horde_Auth_Exception('No password file set.'); } if ($this->_params['lock']) { @@ -169,7 +169,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base $fp = fopen($this->_params['filename'], 'r'); if (!$fp) { - throw new Horde_Exception("Couldn't open '" . $this->_params['filename'] . "'."); + throw new Horde_Auth_Exception("Couldn't open '" . $this->_params['filename'] . "'."); } $this->_users = array(); @@ -215,7 +215,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base if (!empty($this->_params['group_filename'])) { $fp = fopen($this->_params['group_filename'], 'r'); if (!$fp) { - throw new Horde_Exception("Couldn't open '" . $this->_params['group_filename'] . "'."); + throw new Horde_Auth_Exception("Couldn't open '" . $this->_params['group_filename'] . "'."); } $this->_groups = array(); @@ -242,24 +242,24 @@ class Horde_Auth_Passwd extends Horde_Auth_Base * @param array $credentials An array of login credentials. For MCAL, * this must contain a password entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } try { $this->_read(); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } if (!isset($this->_users[$userId]) || !$this->_comparePasswords($this->_users[$userId]['password'], $credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } if (!empty($this->_params['required_groups'])) { @@ -272,7 +272,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base } if (!$allowed) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } } @@ -281,7 +281,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -306,18 +306,18 @@ class Horde_Auth_Passwd extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to add. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { $this->_read(); if (!$this->_locked) { - throw new Horde_Exception('Password file not locked'); + throw new Horde_Auth_Exception('Password file not locked'); } if (isset($this->_users[$userId])) { - throw new Horde_Exception("Couldn't add user '$user', because the user already exists."); + throw new Horde_Auth_Exception("Couldn't add user '$user', because the user already exists."); } $this->_users[$userId] = array( @@ -336,18 +336,18 @@ class Horde_Auth_Passwd extends Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { $this->_read(); if (!$this->_locked) { - throw new Horde_Exception('Password file not locked'); + throw new Horde_Auth_Exception('Password file not locked'); } if (!isset($this->_users[$userId])) { - throw new Horde_Exception("Couldn't modify user '$oldID', because the user doesn't exist."); + throw new Horde_Auth_Exception("Couldn't modify user '$oldID', because the user doesn't exist."); } $this->_users[$newID] = array( @@ -366,7 +366,7 @@ class Horde_Auth_Passwd extends Horde_Auth_Base * @param string $userId The user id for which to reset the password. * * @return string The new password. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function resetPassword($userId) { @@ -381,18 +381,18 @@ class Horde_Auth_Passwd extends Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { $this->_read(); if (!$this->_locked) { - throw new Horde_Exception('Password file not locked'); + throw new Horde_Auth_Exception('Password file not locked'); } if (!isset($this->_users[$userId])) { - throw new Horde_Exception("Couldn't delete user '$oldID', because the user doesn't exist."); + throw new Horde_Auth_Exception("Couldn't delete user '$oldID', because the user doesn't exist."); } unset($this->_users[$userId]); diff --git a/framework/Auth/lib/Horde/Auth/Peclsasl.php b/framework/Auth/lib/Horde/Auth/Peclsasl.php index 6b3dd9a9d..5672a0bd6 100644 --- a/framework/Auth/lib/Horde/Auth/Peclsasl.php +++ b/framework/Auth/lib/Horde/Auth/Peclsasl.php @@ -34,12 +34,12 @@ class Horde_Auth_Peclsasl extends Horde_Auth_Base * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('sasl')) { - throw new Horde_Exception('Horde_Auth_Peclsasl:: requires the sasl PECL extension to be loaded.'); + throw new Horde_Auth_Exception('Horde_Auth_Peclsasl:: requires the sasl PECL extension to be loaded.'); } $params = array_merge(array( @@ -58,21 +58,21 @@ class Horde_Auth_Peclsasl extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $conn = sasl_server_new($this->_params['service']); if (!is_resource($conn)) { - throw new Horde_Exception(_("Failed to create new SASL connection.")); + throw new Horde_Auth_Exception(_("Failed to create new SASL connection.")); } if (!sasl_checkpass($conn, $userId, $credentials['password'])) { - throw new Horde_Exception(sasl_errdetail($conn)); + throw new Horde_Auth_Exception(sasl_errdetail($conn)); } } diff --git a/framework/Auth/lib/Horde/Auth/Radius.php b/framework/Auth/lib/Horde/Auth/Radius.php index 05b42fe23..0cd860007 100644 --- a/framework/Auth/lib/Horde/Auth/Radius.php +++ b/framework/Auth/lib/Horde/Auth/Radius.php @@ -62,29 +62,29 @@ class Horde_Auth_Radius extends Horde_Auth_Base * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { parent::__construct($params); if (!Horde_Util::extensionExists('radius')) { - throw new Horde_Exception('Horde_Auth_Radius:: requires the radius PECL extension to be loaded.'); + throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires the radius PECL extension to be loaded.'); } /* A RADIUS host is required. */ if (empty($this->_params['host'])) { - throw new Horde_Exception('Horde_Auth_Radius:: requires a RADIUS host to connect to.'); + throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires a RADIUS host to connect to.'); } /* A RADIUS secret string is required. */ if (empty($this->_params['secret'])) { - throw new Horde_Exception('Horde_Auth_Radius:: requires a RADIUS secret string.'); + throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires a RADIUS secret string.'); } /* A RADIUS authentication method is required. */ if (empty($this->_params['method'])) { - throw new Horde_Exception('Horde_Auth_Radius:: requires a RADIUS authentication method.'); + throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires a RADIUS authentication method.'); } /* RADIUS NAS Identifier. */ @@ -123,13 +123,13 @@ class Horde_Auth_Radius extends Horde_Auth_Base * For radius, this must contain a password * entry. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($username, $credentials) { /* Password is required. */ if (!isset($credentials['password'])) { - throw new Horde_Exception(_("Password required for RADIUS authentication.")); + throw new Horde_Auth_Exception(_("Password required for RADIUS authentication.")); } $res = radius_auth_open(); @@ -153,10 +153,10 @@ class Horde_Auth_Radius extends Horde_Auth_Base break; case RADIUS_ACCESS_REJECT: - throw new Horde_Exception(_("Authentication rejected by RADIUS server.")); + throw new Horde_Auth_Exception(_("Authentication rejected by RADIUS server.")); default: - throw new Horde_Exception(radius_strerror($res)); + throw new Horde_Auth_Exception(radius_strerror($res)); } } diff --git a/framework/Auth/lib/Horde/Auth/Shibboleth.php b/framework/Auth/lib/Horde/Auth/Shibboleth.php index cd7ee2197..8d0fffa21 100644 --- a/framework/Auth/lib/Horde/Auth/Shibboleth.php +++ b/framework/Auth/lib/Horde/Auth/Shibboleth.php @@ -63,12 +63,12 @@ class Horde_Auth_Shibboleth extends Horde_Auth_Base * configured header. * * @return boolean Whether or not the client is allowed. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _transparent() { if (empty($_SERVER[$this->_params['username_header']])) { - throw new Horde_Exception(_("Shibboleth authentication not available.")); + throw new Horde_Auth_Exception(_("Shibboleth authentication not available.")); } $username = $_SERVER[$this->_params['username_header']]; diff --git a/framework/Auth/lib/Horde/Auth/Smb.php b/framework/Auth/lib/Horde/Auth/Smb.php index 9abfd859d..291004667 100644 --- a/framework/Auth/lib/Horde/Auth/Smb.php +++ b/framework/Auth/lib/Horde/Auth/Smb.php @@ -40,12 +40,12 @@ class Horde_Auth_Smb extends Horde_Auth_Base * * @param array $params A hash containing connection parameters. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function __construct($params = array()) { if (!Horde_Util::extensionExists('smbauth')) { - throw new Horde_Exception(_("Horde_Auth_Smb: Required smbauth extension not found.")); + throw new Horde_Auth_Exception(_("Horde_Auth_Smb: Required smbauth extension not found.")); } /* Ensure we've been provided with all of the necessary parameters. */ @@ -62,12 +62,12 @@ class Horde_Auth_Smb extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } /* Authenticate. */ @@ -78,9 +78,9 @@ class Horde_Auth_Smb extends Horde_Auth_Base $credentials['password']); if ($rval === 1) { - throw new Horde_Exception(_("Failed to connect to SMB server.")); + throw new Horde_Auth_Exception(_("Failed to connect to SMB server.")); } elseif ($rval !== 0) { - throw new Horde_Exception(err2str()); + throw new Horde_Auth_Exception(err2str()); } } diff --git a/framework/Auth/lib/Horde/Auth/Smbclient.php b/framework/Auth/lib/Horde/Auth/Smbclient.php index c2e7201c1..24f6b2193 100644 --- a/framework/Auth/lib/Horde/Auth/Smbclient.php +++ b/framework/Auth/lib/Horde/Auth/Smbclient.php @@ -49,12 +49,12 @@ class Horde_Auth_Smbclient extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials An array of login credentials. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { if (empty($credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } /* Authenticate. */ @@ -68,14 +68,14 @@ class Horde_Auth_Smbclient extends Horde_Auth_Base $sc = popen($cmdline, 'w'); if ($sc === false) { - throw new Horde_Exception(_("Unable to execute smbclient.")); + throw new Horde_Auth_Exception(_("Unable to execute smbclient.")); } fwrite($sc, $credentials['password']); $rc = pclose($sc); if ((int)($rc & 0xff) != 0) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } } diff --git a/framework/Auth/lib/Horde/Auth/Sql.php b/framework/Auth/lib/Horde/Auth/Sql.php index dda5f5599..e2674e3a3 100644 --- a/framework/Auth/lib/Horde/Auth/Sql.php +++ b/framework/Auth/lib/Horde/Auth/Sql.php @@ -111,15 +111,15 @@ class Horde_Auth_Sql extends Horde_Auth_Base * @param string $userId The userId to check. * @param array $credentials The credentials to use. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ protected function _authenticate($userId, $credentials) { try { $this->_connect(); - } catch (Horde_Exception $e) { + } catch (Horde_Auth_Exception $e) { Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } /* Build the SQL query. */ @@ -133,26 +133,26 @@ class Horde_Auth_Sql extends Horde_Auth_Base $result = $this->_db->query($query, $values); if ($result instanceof PEAR_Error) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception('', Horde_Auth::REASON_FAILED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); } $row = $result->fetchRow(DB_GETMODE_ASSOC); if (is_array($row)) { $result->free(); } else { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } if (!$this->_comparePasswords($row[$this->_params['password_field']], $credentials['password'])) { - throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); } $now = time(); if (!empty($this->_params['hard_expiration_field']) && !empty($row[$this->_params['hard_expiration_field']]) && ($now > $row[$this->_params['hard_expiration_field']])) { - throw new Horde_Exception('', Horde_Auth::REASON_EXPIRED); + throw new Horde_Auth_Exception('', Horde_Auth::REASON_EXPIRED); } if (!empty($this->_params['soft_expiration_field']) && @@ -168,7 +168,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base * @param string $userId The userId to add. * @param array $credentials The credentials to add. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function addUser($userId, $credentials) { @@ -189,7 +189,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base $result = $this->_write_db->query($query, $values); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } } @@ -200,7 +200,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base * @param string $newID The new userId. * @param array $credentials The new credentials * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function updateUser($oldID, $newID, $credentials) { @@ -258,7 +258,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base $result = $this->_write_db->query($query, $values); if ($result instanceof PEAR_Error) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } } @@ -269,7 +269,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base * @param string $userId The user id for which to reset the password. * * @return string The new password on success. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function resetPassword($userId) { @@ -293,7 +293,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base $result = $this->_write_db->query($query, $values); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } return $password; @@ -304,7 +304,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base * * @param string $userId The userId to delete. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function removeUser($userId) { @@ -320,7 +320,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base $result = $this->_write_db->query($query, $values); if ($result instanceof PEAR_Error) { - throw new Horde_Exception($result); + throw new Horde_Auth_Exception($result); } Horde_Auth::removeUserData($userId); @@ -330,7 +330,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base * List all users in the system. * * @return array The array of userIds. - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ public function listUsers() { @@ -345,7 +345,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base $res = $this->_db->getCol($query); if ($res instanceof PEAR_Error) { - throw new Horde_Exception($res); + throw new Horde_Auth_Exception($res); } return $res; @@ -394,7 +394,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base /** * Attempts to open a connection to the SQL server. * - * @throws Horde_Exception + * @throws Horde_Auth_Exception */ function _connect() { @@ -442,7 +442,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base array('persistent' => !empty($this->_params['persistent']), 'ssl' => !empty($this->_params['ssl']))); if ($this->_write_db instanceof PEAR_Error) { - throw new Horde_Exception($this->_write_db); + throw new Horde_Auth_Exception($this->_write_db); } // Set DB portability options. @@ -462,7 +462,7 @@ class Horde_Auth_Sql extends Horde_Auth_Base array('persistent' => !empty($params['persistent']), 'ssl' => !empty($params['ssl']))); if ($this->_db instanceof PEAR_Error) { - throw new Horde_Exception($this->_db); + throw new Horde_Auth_Exception($this->_db); } switch ($this->_db->phptype) { diff --git a/framework/Auth/package.xml b/framework/Auth/package.xml index ca8c02677..eacb2c26d 100644 --- a/framework/Auth/package.xml +++ b/framework/Auth/package.xml @@ -51,6 +51,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + @@ -153,6 +154,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + -- 2.11.0