commit 0ad4a2e392c5618a97767a4fa938a5b98c723d19
parent a5cc3c371bf290f798eafccfbaa0832758b42247
Author: Jan Dankert <devnull@localhost>
Date: Fri, 25 May 2018 01:47:45 +0200
Fix: Keine Laufzeitfehler erzeugen, wenn LDAP-Extension nicht geladen ist.
Diffstat:
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/modules/cms-core/auth/LdapAuth.class.php b/modules/cms-core/auth/LdapAuth.class.php
@@ -5,6 +5,14 @@ class LdapAuth implements Auth
public function login($username, $password, $token)
{
+
+ // Falls Modul LDAP nicht vorhanden ist können wir gleich beenden.
+ if (!extension_loaded('ldap')){
+
+ Logger::warn("LdapAuth: LDAP Login is not possible: LDAP-Extension ist not loaded.");
+ return false;
+ }
+
global $conf;
$db = db_connection();
$this->mustChangePassword = false;
diff --git a/modules/cms-core/auth/LdapUserDNAuth.class.php b/modules/cms-core/auth/LdapUserDNAuth.class.php
@@ -7,7 +7,6 @@
*/
class LdapUserDNAuth implements Auth
{
-
/**
* @see Auth::login()
*/
@@ -35,8 +34,16 @@ SQL
if ( empty($ldap_dn ) )
return false;
-
- Logger::debug( 'checking login via ldap' );
+
+ // Falls Modul LDAP nicht vorhanden ist können wir gleich beenden.
+ if (!extension_loaded('ldap')){
+
+ Logger::warn("LDAP Login is not possible: LDAP-Extension ist not loaded.");
+ return false;
+ }
+
+
+ Logger::debug( 'checking login via ldap' );
$ldap = new Ldap();
$ldap->connect();
diff --git a/modules/util/require.php b/modules/util/require.php
@@ -5,7 +5,10 @@ require_once( __DIR__.'/'.'Http.class.php' );
require_once( __DIR__.'/'.'Html.class.php' );
require_once( __DIR__.'/'.'Text.class.php' );
require_once( __DIR__.'/'.'Mail.class.php' );
-require_once( __DIR__.'/'.'Ldap.class.php' );
+
+if (extension_loaded('ldap') )
+ require_once( __DIR__.'/'.'Ldap.class.php' );
+
require_once( __DIR__.'/'.'FileUtils.class.php' );
require_once( __DIR__.'/'.'JSON.class.php' );
require_once( __DIR__.'/'.'Less.php' );