From 192b6eb65db7421b5b4b5577bb09e3dbf98eec35 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 1 Dec 2015 19:22:56 +0100 Subject: [PATCH] (captiveportal, new) failsafe, don't try to authenticate if handler not found --- .../CaptivePortal/Api/AccessController.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php b/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php index 49155ea7e..8ba9e3f5b 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php @@ -141,15 +141,17 @@ class AccessController extends ApiControllerBase $authFactory = new AuthenticationFactory(); foreach (explode(',', (string)$cpZone->authservers) as $authServerName) { $authServer = $authFactory->get(trim($authServerName)); - // try this auth method - $isAuthenticated = $authServer->authenticate( - $userName, - $this->request->getPost("password", "string") - ); + if ($authServer != null) { + // try this auth method + $isAuthenticated = $authServer->authenticate( + $userName, + $this->request->getPost("password", "string") + ); - if ($isAuthenticated) { - // stop trying, when authenticated - break; + if ($isAuthenticated) { + // stop trying, when authenticated + break; + } } } } else {