cvs: pear /Auth Auth.php
| From: | Yavor Shahpasov | Date: | Thu, 08 Jul 2004 11:05:37 +0000 |
| Subject: | cvs: pear /Auth Auth.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21639@lists.php.net to get a copy of this message | ||
yavo Thu Jul 8 07:05:37 2004 EDT
Modified files:
/pear/Auth Auth.php
Log:
changed getAuth to return checkAuth which is the correct way to check if a user is authenthicated
http://cvs.php.net/diff.php/pear/Auth/Auth.php?r1=1.88&r2=1.89&ty=u
Index: pear/Auth/Auth.php
diff -u pear/Auth/Auth.php:1.88 pear/Auth/Auth.php:1.89
--- pear/Auth/Auth.php:1.88 Tue Jul 6 02:49:48 2004
+++ pear/Auth/Auth.php Thu Jul 8 07:05:37 2004
@@ -16,7 +16,7 @@
// | Authors: Martin Jansen <mj@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Auth.php,v 1.88 2004/07/06 06:49:48 yavo Exp $
+// $Id: Auth.php,v 1.89 2004/07/08 11:05:37 yavo Exp $
//
define('AUTH_IDLED', -1);
@@ -33,7 +33,7 @@
*
* @author Martin Jansen <mj@php.net>
* @package Auth
- * @version $Revision: 1.88 $
+ * @version $Revision: 1.89 $
*/
class Auth {
@@ -654,14 +654,14 @@
$this->session['registered'] == true &&
$this->session['username'] != '') {
Auth::updateIdle();
- // Only Generate the challenge once
- if($this->authChecks == 1) {
- $this->session['challengecookieold'] =
$this->session['challengecookie'];
- $this->session['challengecookie'] =
md5($this->session['challengekey'].microtime());
- setcookie('authchallenge',
$this->session['challengecookie']);
- }
if ($this->advancedsecurity) {
+ // Only Generate the challenge once
+ if($this->authChecks == 1) {
+ $this->session['challengecookieold'] =
$this->session['challengecookie'];
+ $this->session['challengecookie'] =
md5($this->session['challengekey'].microtime());
+ setcookie('authchallenge',
$this->session['challengecookie']);
+ }
// Check for ip change
if ( isset($this->server['REMOTE_ADDR']) &&
$this->session['sessionip'] != $this->server['REMOTE_ADDR']) {
// Check if the IP of the user has changed, if so we assume a man in the
middle attack and log him out
@@ -680,6 +680,8 @@
}
// Check challenge cookie here, if challengecookieold is not set this is the
first time and check is skipped
+ // TODO when user open two pages similtaneuly (open in new window,open in tab)
auth breach is caused
+ // find out a way around that if possible
if ( isset($this->session['challengecookieold']) &&
$this->session['challengecookieold'] != $this->cookie['authchallenge']) {
$this->expired = true;
$this->status = AUTH_SECURITY_BREACH;
@@ -717,10 +719,7 @@
* @return bool True if the user is logged in, otherwise false.
*/
function getAuth() {
- if ( isset($this->session['registered']) ) {
- return $this->session['registered'];
- }
- return false;
+ return $this->checkAuth();
}
/**