diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php
index 5bcd40d424e..67f7ce14ef4 100644
--- a/htdocs/core/login/functions_ldap.php
+++ b/htdocs/core/login/functions_ldap.php
@@ -166,9 +166,13 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset, 'day')."
\n";
if ($ldapdebug) print "DEBUG: badPasswordTime = ".dol_print_date($ldap->badpwdtime, 'day')."
\n";
- // On recherche le user dolibarr en fonction de son SID ldap
- $sid = $ldap->getObjectSid($login);
- if ($ldapdebug) print "DEBUG: sid = ".$sid."
\n";
+ // On recherche le user dolibarr en fonction de son SID ldap (only for Active Directory)
+ $sid = null;
+ if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
+ {
+ $sid = $ldap->getObjectSid($login);
+ if ($ldapdebug) print "DEBUG: sid = ".$sid."
\n";
+ }
$usertmp=new User($db);
$resultFetchUser=$usertmp->fetch('', $login, $sid);