#21113 [Opn]: Auth bug
| From: | entis at poczta dot fm | Date: | Fri, 20 Dec 2002 14:30:21 +0000 |
| Subject: | #21113 [Opn]: Auth bug | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11778@lists.php.net to get a copy of this message | ||
ID: 21113
User updated by: entis@poczta.fm
Reported By: entis@poczta.fm
Status: Open
Bug Type: PEAR related
Operating System: winxp
PHP Version: 4.2.3
New Comment:
the same bug is in methods :
_connect
addUser
removeUser
listUsers
Previous Comments:
------------------------------------------------------------------------
[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