aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPAM.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggPAM.php')
-rw-r--r--engine/classes/ElggPAM.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/engine/classes/ElggPAM.php b/engine/classes/ElggPAM.php
index 37436fba3..f07095fc1 100644
--- a/engine/classes/ElggPAM.php
+++ b/engine/classes/ElggPAM.php
@@ -41,18 +41,29 @@ class ElggPAM {
* @param array $credentials Credentials array dependant on policy type
* @return bool
*/
- public function authenticate($credentials) {
+ public function authenticate($credentials = array()) {
global $_PAM_HANDLERS;
+ if (!isset($_PAM_HANDLERS[$this->policy]) ||
+ !is_array($_PAM_HANDLERS[$this->policy])) {
+ return false;
+ }
+
$authenticated = false;
foreach ($_PAM_HANDLERS[$this->policy] as $k => $v) {
$handler = $v->handler;
+ if (!is_callable($handler)) {
+ continue;
+ }
+ /* @var callable $handler */
+
$importance = $v->importance;
try {
// Execute the handler
- $result = $handler($credentials);
+ // @todo don't assume $handler is a global function
+ $result = call_user_func($handler, $credentials);
if ($result) {
$authenticated = true;
} elseif ($result === false) {