diff options
author | Christoph Burschka | 2014-04-13 23:44:16 +0200 |
---|---|---|
committer | Christoph Burschka | 2014-04-13 23:44:16 +0200 |
commit | 759d025bb836d56f63550b4a0c12ce6b9f360266 (patch) | |
tree | 159befe0c410defdef8b4075141250e893b2a8ec /core/EjabberdAuth.php | |
parent | config.php syntax fixes (diff) | |
download | ejabberd-auth-php-759d025bb836d56f63550b4a0c12ce6b9f360266.tar.gz |
Fix #3: Check session bridge before using it.
When config['session'] is not set, the session
bridge doesn't exist and should not be used.
Diffstat (limited to 'core/EjabberdAuth.php')
-rw-r--r-- | core/EjabberdAuth.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/EjabberdAuth.php b/core/EjabberdAuth.php index d88c990..7817d64 100644 --- a/core/EjabberdAuth.php +++ b/core/EjabberdAuth.php @@ -11,7 +11,7 @@ class EjabberdAuth { $this->bridge = $bridge; $this->session = $session; $this->bridge->parent = $this; - $this->session->parent = $this; + if ($this->session) $this->session->parent = $this; if (!empty($config['log_path']) && is_dir($config['log_path']) && is_writable($config['log_path'])) $this->logfile = fopen($config['log_path'] . 'activity-' . date('Y-m-d') . '.log', 'a'); else $this->logfile = STDERR; @@ -69,10 +69,10 @@ class EjabberdAuth { switch ($command) { case 'isuser': - return $this->session->isuser($username, $server) || + return ($this->session && $this->session->isuser($username, $server)) || $this->bridge->isuser($username, $server); case 'auth': - return $this->session->auth($username, $server, $password) || + return ($this->session && $this->session->auth($username, $server, $password)) || $this->bridge->auth($username, $server, $password); case 'setpass': case 'tryregister': |