#21113 [Opn->Csd]: Auth bug
| From: | mj@php.net | Date: | Fri, 03 Jan 2003 11:57:26 +0000 |
| Subject: | #21113 [Opn->Csd]: Auth bug | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12057@lists.php.net to get a copy of this message | ||
ID: 21113
Updated by: mj@php.net
Reported By: entis@poczta.fm
-Status: Open
+Status: Closed
Bug Type: PEAR related
Operating System: winxp
PHP Version: 4.2.3
New Comment:
I've fixed the wrong usage of raiseError(). The changes will appear in
the next release.
Thanks for noticing!
Previous Comments:
------------------------------------------------------------------------
[2002-12-20 08:30:20] entis@poczta.fm
the same bug is in methods :
_connect
addUser
removeUser
listUsers
------------------------------------------------------------------------
[2002-12-20 08:20:59] entis@poczta.fm
there is dangerous bug in Auth package !
In file \Auth\Container\DB.php
In method Auth_Container_DB::fetchData
In lines :
...
$res = $this->query($query);
if (DB::isError($res)) {
return PEAR::raiseError($res->code, PEAR_ERROR_DIE);
} else {
...
compare raiseError definition :
function &raiseError($message = null,
$code = null,
$mode = null,
$options = null,
$userinfo = null,
$error_class = null,
$skipmsg = false)
code should be second parameter and mode should be third parameter.
I check if something go wrong in fetching data from database, this code
don't stop program (PEAR_ERROR_DIE isn't in correct place) and user can
gain unauthorized access. Solution is very simple :
...
$res = $this->query($query);
if (DB::isError($res)) {
return PEAR::raiseError('',$res->code, PEAR_ERROR_DIE);
} else {
...
i have also proposition for Auth::login method :
replace this line :
$login_ok = $this->storage->fetchData($this->username,
$this->password);
with this line :
$login_ok = ($this->storage->fetchData($this->username,
$this->password) === TRUE);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21113&edit=1