Commit 6aca6d8364062082634a7f9272dfccb9a35686e0

Authored by Etienne Pallier
1 parent e3c802f2
Exists in master and in 2 other branches dev, dev-IRAP

bugfix ldap

README.md
... ... @@ -53,10 +53,10 @@ Logiciel testé et validé sur les configurations suivantes :
53 53  
54 54 VERSION ACTUELLE
55 55  
56   -Date: 14/03/2019
57   -Version: 2.11.0
  56 +Date: 25/03/2019
  57 +Version: 2.11.1
58 58 Author: EP
59   - Ajout nouvelle option permettant le "choix du format étiquette"
  59 + Bugfix searchLdap()
60 60  
61 61 IMPORTANT:
62 62 - Pour connaitre la version actuelle, taper "./VERSION"
... ...
doc/Labinvent Documentation.docx deleted
No preview for this file type
src/Model/Table/LdapConnectionsTable.php
... ... @@ -279,7 +279,7 @@ class LdapConnectionsTable extends AppTable
279 279 if ($users_fetched === FALSE) {
280 280 $users_fetched = $this->searchLdap($this->filter, []);
281 281 // CACHE the new user in DB for next time
282   - if ($users_fetched != FALSE) $this->saveAllUsersInDB($users_fetched);
  282 + if ($users_fetched !== FALSE) $this->saveAllUsersInDB($users_fetched);
283 283 }
284 284 /*
285 285 $ldapConnection = ldap_connect($this->host, $this->port);
... ... @@ -595,7 +595,7 @@ class LdapConnectionsTable extends AppTable
595 595  
596 596 // CONNEXION
597 597 $ldapConnection = ldap_connect($this->host, $this->port)
598   - or die("Could not connect to $this->host (port $this->port)");
  598 + or die("Could not connect to $this->host (port $this->port)");
599 599  
600 600 if ($ldapConnection) {
601 601  
... ... @@ -603,18 +603,21 @@ class LdapConnectionsTable extends AppTable
603 603 ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3);
604 604  
605 605 // BINDING
606   -
607 606 $ldapbind = TRUE;
608   - if ($user_login && $user_password) {
  607 +
  608 + if ($this->ldap_authentified)
609 609 // - Authentified
610   - if ($this->ldap_authentified) $ldapbind = ldap_bind($ldapConnection, $this->bindDn, $this->bindPass);
611   - // or die("Could not bind to LDAP server.". ldap_error($ldapConnection) );
612   -
  610 + $ldapbind = ldap_bind($ldapConnection, $this->bindDn, $this->bindPass)
  611 + or die("Could not bind to LDAP server.". ldap_error($ldapConnection) );
  612 +
  613 + else {
613 614 // - Anonymous
614 615 // En cas de LDAP anonyme, binding quand même pour vérifier le mot de passe de l'utilisateur.
615 616 // Sans cette ligne, on passe avec n'importe quel password !!!
616   - else $ldapbind = ldap_bind($ldapConnection, $this->authenticationType . '=' . $user_login . ',' . $this->baseDn, $user_password);
617   - /*
  617 + if ($user_login && $user_password)
  618 + $ldapbind = ldap_bind($ldapConnection, $this->authenticationType . '=' . $user_login . ',' . $this->baseDn, $user_password)
  619 + or die("Could not bind to LDAP server.". ldap_error($ldapConnection) );
  620 + /*
618 621 else {
619 622 $ldapbind = TRUE;
620 623 // function ldap_bind ($link_identifier, $bind_rdn = null, $bind_password = null)
... ... @@ -871,4 +874,4 @@ class LdapConnectionsTable extends AppTable
871 874  
872 875  
873 876 }
874   -?>
875 877 \ No newline at end of file
  878 +?>
... ...