Warning messages when using LDAP as main authentic

DOLIBARR ENVIRONMENT
- Version: 8.0.3
- Operating System: Debian 9
- Web Server: Apache/2.4.25 (Debian)
- PHP: 5.6.4
- Database: Maria DB 10.4
- URL(s): /index.php?mainmenu=home

I am receiving warning messages at the top of the web page upon first connecting to Dolibarr. The warning messages are:

Warning: ldap_get_values_len(): Cannot get the value(s) of attribute Decoding error in /var/www/html/core/class/ldap.class.php on line 1168

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/class/ldap.class.php:1168) in /var/www/html/main.inc.php on line 1094

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/class/ldap.class.php:1168) in /var/www/html/main.inc.php on line 1097

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/class/ldap.class.php:1168) in /var/www/html/main.inc.php on line 1098

A similar error was encountered by another user, and he recounts this here:

The behavior of my Dolibarr front-end is identical to this user:

- The errors are only reproducible when using LDAP as main authentication.

- The warnings are only present upon first authenticating into Dolibarr. Further navigation in Dolibarr, even back to the original home page, does not produce/reproduce any errors.

- The LDAP authentication is successful. Dolibarr is still functional despite the warnings present upon first login.

I also replicated the entire process with Dolibarr version 8.0.4, but the same errors were produced.

I would like to make the necessary changes that would allow users to access the web page without receiving any error messages. Any help with this would be appreciated.

Thank you

what is the type and version of your LDAP server (openldap, AD, …)?

1 Like

can you edit this file

/core/class/ldap.class.php

line 1168

$ldapBinary = ldap_get_values_len($this->connection, $entry, “objectsid”);

try to replace “objectsid” with “objectSid”

$ldapBinary = ldap_get_values_len($this->connection, $entry, “objectSid”);

Hi,

I did make this change to /core/class/ldap.class.php,

line 1168 - replace “objectsid” with “objectSid”

Unfortunately the same warning errors persist. Any other ideas?

Thanks

Hi,

I should have mentioned this in my original post, sorry. I am using Open LDAP Version 3.

Thanks

the function that creates the error is only called when using Active Directory (Windows server)! Is this your case?

Hello,

Thanks for your response. It looks as though the function getObjectSid($ldapUser) checks to see if your are using Windows AD, and then if you are not it continues on to the next IF statement. It looks as though when this function is called it is bypassing the first IF statement (Windows AD flow check), and proceeding on to the next if statement (which contains line 1168).

I’ve also confirmed that my Dolibarr front-end and conf.php are configured for OpenLDAP Version 3. I’m not a PHP expert so my interpretation may be off. Let me know!

Thanks

you use synchro “dolibarr -> ldap” or “ldap -> dolibarr” ?

Hi,

I’m using "ldap -> dolibarr.

Thanks

can you edit again ldap.class.php line 1168 and replace with

var_dump($entry);
$ldapBinary = @ldap_get_values_len($this->connection, $entry, “objectsid”);
var_dump($ldapBinary);
echo ldap_errno($this->connection)." ".ldap_error($this->connection);

try to connect the user and send me the return

you can try this fix in “/core/login/functions_ldap.php” :

1 Like

The return after modifying ldap.class.php:

resource(40) of type (ldap result entry)

Warning: ldap_get_values_len(): Cannot get the value(s) of attribute Decoding error in /var/www/html/core/class/ldap.class.php on line 1169

bool(false) -4 Decoding error

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/class/ldap.class.php:1168) in /var/www/html/main.inc.php on line 1094

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/class/ldap.class.php:1168) in /var/www/html/main.inc.php on line 1097

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/core/class/ldap.class.php:1168) in /var/www/html/main.inc.php on line 1098

Let me know if this output helps identify a problem.

I have not yet tried the fix github.com/Dolibarr/dolibarr/pull/11964/files. I will provide an update after implementing this.

Thanks

This solved the issue, and no warning errors are present upon authenticating with OpenLDAP.

Thank you for the help!