Subject: /usr/bin/ldapsearch: Error - Could not parse LDAP URI<br>Package: ldap-utils<br>Version: 2.4.23-7.2<br>File: /usr/bin/ldapsearch<br>Severity: normal<br><br>While trying to debug Apache2 LDAP Auth (Debian 6 ) I found this: "ldapsearch -H" can't parse ldap URLs that have baseDn info  even the ones created by ldapurl.<br>
<br>LDAP Host: <a href="http://master.example.org">master.example.org</a> (172.20.100.120).<br>baseDN: dc=example,dc=org<br><br>DNS is OK, ping <a href="http://master.example.org">master.example.org</a> resolves successfully. Asides, the error<br>
shows when use the server IP too.<br><br>ldapsearch -x -H "ldap://<a href="http://172.20.100.120/dc=example,dc=org">172.20.100.120/dc=example,dc=org</a>"<br>Could not parse LDAP URI(s)=ldap://<a href="http://172.20.100.120/dc=example,dc=org">172.20.100.120/dc=example,dc=org</a> (3)<br>
<br>ldapsearch -x -H "ldap://<a href="http://master.example.org/dc=example,dc=org">master.example.org/dc=example,dc=org</a>"<br>Could not parse LDAP URI(s)=ldap://<a href="http://master.example.org/dc=example,dc=org">master.example.org/dc=example,dc=org</a> (3)<br>
<br>ldapsearch -x  -b "dc=example,dc=org" -H "ldap://<a href="http://master.example.org/">master.example.org/</a>"<br>(works ok!)<br><br>ldapsearch -x -h <a href="http://master.example.org">master.example.org</a> -b "dc=example,dc=org"<br>
(works ok!)<br><br>Using ldapurl to create the URI, with the data from previous (working) command:<br>ldapurl -h <a href="http://master.example.org">master.example.org</a> -b "dc=example,dc=org"<br>returns this: ldap://<a href="http://master.example.org:389/dc=example,dc=org">master.example.org:389/dc=example,dc=org</a><br>
<br>last try: redirect output of ldapurl directly to ldapsearch -H:<br>ldapsearch -x -H $(ldapurl -h <a href="http://master.example.org">master.example.org</a> -b "dc=example,dc=org")<br>Could not parse LDAP URI(s)=ldap://<a href="http://master.example.org:389/dc=example,dc=org">master.example.org:389/dc=example,dc=org</a> (3)<br>
(same error)<br><br>PS: The error is in other Debian 6 system (no graphic, ssh only). I can provide<br>more info if is needed. BTW, apache auth is working, using the very same URL<br>returned by ldapurl command.<br><br><br>
<br><br>-- System Information:<br>Debian Release: 6.0.5<br>  APT prefers stable-updates<br>  APT policy: (500, 'stable-updates'), (500, 'stable')<br>Architecture: amd64 (x86_64)<br><br>Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)<br>
Locale: LANG=pt_BR.utf8, LC_CTYPE=pt_BR.utf8 (charmap=UTF-8)<br>Shell: /bin/sh linked to /bin/dash<br><br>Versions of packages ldap-utils depends on:<br>ii  libc6                   2.11.3-3         Embedded GNU C Library: Shared lib<br>
ii  libgnutls26             2.8.6-1+squeeze2 the GNU TLS library - runtime libr<br>ii  libldap-2.4-2           2.4.23-7.2       OpenLDAP libraries<br>ii  libsasl2-2              2.1.23.dfsg1-7   Cyrus SASL - authentication abstra<br>
<br>Versions of packages ldap-utils recommends:<br>ii  libsasl2-modules          2.1.23.dfsg1-7 Cyrus SASL - pluggable authenticat<br><br>ldap-utils suggests no packages.<br><br>-- no debconf information<br>