With the following patch things work as expected: (ldap-search "(uid=)" "ldap://" '("mail") nil t) => ((("dn" "cn=,L=,DC=,DC=COM") ("mail" "@.com"))) I tried to make the patch as conservative as possible and intentionally do not check syntax of the dn line if its parsing is not required.