From 8c91f6ff2adab21b042f4c03417477d997eca20b Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Wed, 13 Dec 2017 23:51:21 +0100 Subject: [PATCH] Add exception to LdapServer and LdapDomain construct --- htdocs/lib/auth.php | 16 ++++++++---- htdocs/lib/class.ldapdomain.php | 44 ++++++++++++++++----------------- htdocs/lib/class.ldapserver.php | 13 ++++++---- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/htdocs/lib/auth.php b/htdocs/lib/auth.php index c7242fe..adb5242 100644 --- a/htdocs/lib/auth.php +++ b/htdocs/lib/auth.php @@ -7,12 +7,18 @@ if (empty($_SESSION['login'])) { header("location: auth.php\n\n"); exit(0); } else { - if (!$server = new LdapServer($_SESSION['login'])) { - print "
Erreur de connexion LDAP !
"; - exit(1); - } else { + try { + $server = new LdapServer($_SESSION['login']); if (!empty($_GET['domain'])) { - $domain = new LdapDomain($server, Html::clean($_GET['domain'])); + try { + $domain = new LdapDomain($server, Html::clean($_GET['domain'])); + } catch (Exception $e_d) { + print '