Code Monkey home page Code Monkey logo

Comments (4)

cedric-anne avatar cedric-anne commented on June 22, 2024 1

Hi,

This issue will be fixed by #16806. As it requires a migration, the patch cannot be applied in a production environment.

You can apply the following patch instead, on GLPI 10.0.14, to fix the issue until GLPI 10.0.15 is released:

diff --git a/src/User.php b/src/User.php
index 695fe4df5f..5349a49322 100644
--- a/src/User.php
+++ b/src/User.php
@@ -567,7 +567,7 @@ class User extends CommonDBTM
          * and is indexed in the database, making it faster to search.
          */
         return $this->getFromDBByCrit([
-            'user_dn_hash' => md5($user_dn)
+            'user_dn_hash' => md5(Sanitizer::sanitize($user_dn))
         ]);
     }
 
@@ -847,7 +847,7 @@ class User extends CommonDBTM
     {
         // Hash user_dn if set
         if (isset($this->input['user_dn']) && is_string($this->input['user_dn']) && strlen($this->input['user_dn']) > 0) {
-            $this->input['user_dn_hash'] = md5($this->input['user_dn']);
+            $this->input['user_dn_hash'] = md5(Sanitizer::sanitize($this->input['user_dn']));
         }
     }
 
@@ -3503,7 +3503,7 @@ HTML;
         // Hash user_dn if is updated
         if (in_array('user_dn', $this->updates)) {
             $this->updates[] = 'user_dn_hash';
-            $this->fields['user_dn_hash'] = is_string($this->input['user_dn']) && strlen($this->input['user_dn']) > 0 ? md5($this->input['user_dn']) : null;
+            $this->fields['user_dn_hash'] = is_string($this->input['user_dn']) && strlen($this->input['user_dn']) > 0 ? md5(Sanitizer::sanitize($this->input['user_dn'])) : null;
         }
     }
 

from glpi.

TheRoby avatar TheRoby commented on June 22, 2024

Hi,
Same problem with 10.0.13

from glpi.

TheRoby avatar TheRoby commented on June 22, 2024

2ee311a
if i change this :

public function getFromDBbyDn($user_dn)
    {
       [old] return $this->getFromDBByCrit(['user_dn' => $user_dn]);
        /**
         * We use the 'user_dn_hash' field instead of 'user_dn' for performance reasons.
         * The 'user_dn_hash' field is a hashed version of the 'user_dn' field
         * and is indexed in the database, making it faster to search.
         */
        return $this->getFromDBByCrit([
            'user_dn_hash' => md5($user_dn)
        ]);
    }

to the old version, I have 5394 records updated ...

Edit :
With the old getFromDBbyDN i have a lot of "getFromDBByCrit expects to get one result"
With the new, nothing ...

from glpi.

TheRoby avatar TheRoby commented on June 22, 2024

I think I found a clue :
2ee311a#commitcomment-139834247

from glpi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.