1

Topic: Roundcube "PHP Error: LDAP: ldap_list failed"

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.4.0
- Deployed with iRedMail Easy or the downloadable installer?: downloadable installer
- Linux/BSD distribution name and version: Ubuntu 20.04.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hey,

I recently noticed a strange error Message in our "/var/log/mail.log" when searching for a Contact in Roundcube:

May 31 12:50:46 hostname roundcube: <7b0qppp0> PHP Error: LDAP: ldap_list failed for dn=domainName=domain.tld,o=domains,dc=mx,dc=company,dc=tld. Bad search filter (POST /mail/?_task=mail&_action=autocomplete)

Searching for that error brings up several old Forum posts:
https://forum.iredmail.org/topic11503-i … issue.html
https://forum.iredmail.org/topic9520-ir … illog.html
https://forum.iredmail.org/topic12197-i … r-log.html

But there doesn't seem to be a clear cause / solution for these errors.

I turned on the OpenLDAP debug mode to check which ldap search filter it sent:

May 31 12:59:31 hostname roundcube: <4d4k4929> C: Connect [127.0.0.1:389]
May 31 12:59:31 hostname roundcube: <4d4k4929> S: OK
May 31 12:59:31 hostname roundcube: <4d4k4929> C: Bind [dn: mail=user@domain.tld,ou=Users,domainName=domain.tld,o=domains,dc=mx,dc=company,dc=tld]
May 31 12:59:31 hostname roundcube: <4d4k4929> S: OK
May 31 12:59:31 hostname roundcube: <4d4k4929> C: Search base dn: [domainName=domain.tld,o=domains,dc=mx,dc=company,dc=tld] scope [sub] with filter [(&(&(enabledService=mail)(enabledService=deliver)(enabledService=displayedInGlobalAddressBook)(|(objectClass=mailUser)(objectClass=mailList)(objectClass=mailAlias)))(|(cn=*test*)(givenname=*test*)(sn=*test*)(mail=*test*)))]
May 31 12:59:31 hostname roundcube: <4d4k4929> Using function ldap_search on scope sub ($ns_function is ldap_search)
May 31 12:59:31 hostname roundcube: <4d4k4929> C: (Without VLV) Setting a filter of (&(&(enabledService=mail)(enabledService=deliver)(enabledService=displayedInGlobalAddressBook)(|(objectClass=mailUser)(objectClass=mailList)(objectClass=mailAlias)))(|(cn=*test*)(givenname=*test*)(sn=*test*)(mail=*test*)))
May 31 12:59:31 hostname roundcube: <4d4k4929> Executing search with return attributes: array (
May 31 12:59:31 hostname roundcube:   0 => 'cn',
May 31 12:59:31 hostname roundcube:   1 => 'sn',
May 31 12:59:31 hostname roundcube:   2 => 'givenname',
May 31 12:59:31 hostname roundcube:   3 => 'title',
May 31 12:59:31 hostname roundcube:   4 => 'mail',
May 31 12:59:31 hostname roundcube:   5 => 'telephonenumber',
May 31 12:59:31 hostname roundcube:   6 => 'mobile',
May 31 12:59:31 hostname roundcube:   7 => 'facsimiletelephonenumber',
May 31 12:59:31 hostname roundcube:   8 => 'street',
May 31 12:59:31 hostname roundcube:   9 => 'postalcode',
May 31 12:59:31 hostname roundcube:   10 => 'l',
May 31 12:59:31 hostname roundcube:   11 => 'departmentnumber',
May 31 12:59:31 hostname roundcube:   12 => 'description',
May 31 12:59:31 hostname roundcube:   13 => 'jpegphoto',
May 31 12:59:31 hostname roundcube:   14 => 'objectClass',
May 31 12:59:31 hostname roundcube:   15 => 'cn',
May 31 12:59:31 hostname roundcube: )
May 31 12:59:31 hostname roundcube: <4d4k4929> S: 3 record(s) found
May 31 12:59:31 hostname roundcube: <4d4k4929> C: Search base dn: [domainName=domain.tld,o=domains,dc=mx,dc=company,dc=tld] scope [] with filter [(&(=*test*))]
May 31 12:59:31 hostname roundcube: <4d4k4929> Using function ldap_list on scope  ($ns_function is ldap_read)
May 31 12:59:31 hostname roundcube: <4d4k4929> C: (Without VLV) Setting a filter of (&(=*test*))
May 31 12:59:31 hostname roundcube: <4d4k4929> Executing search with return attributes: array (
May 31 12:59:31 hostname roundcube:   0 => 'dn',
May 31 12:59:31 hostname roundcube:   1 => 'objectClass',
May 31 12:59:31 hostname roundcube:   2 => NULL,
May 31 12:59:31 hostname roundcube:   3 => 'mail',
May 31 12:59:31 hostname roundcube: )
May 31 12:59:31 hostname roundcube: <4d4k4929> PHP Error: LDAP: ldap_list failed for dn=domainName=domain.tld,o=domains,dc=mx,dc=company,dc=tld. Bad search filter (POST /mail/?_task=mail&_action=autocomplete)
May 31 12:59:31 hostname ool inet: <4d4k4929> C: Close

Running the configured filters via a Terminal works and does return the expected results.

I also compared the default "config.inc.php" with this one https://github.com/iredmail/iRedMail/bl … ok.inc.php and there is no considerable difference between the two.

The completion in Roundcube does seem to work fine. It's just really strange, that this error message gets thrown every time someone triggers a search.

2

Re: Roundcube "PHP Error: LDAP: ldap_list failed"

More like a Roundcube bug. I suggest posting to Roundcube mailing list or issue tracker to get some help. https://github.com/roundcube/roundcubemail/issues

----

Buy me a cup of coffee ($5) to support iRedMail:

buy me a cup of coffee