After adding some debugging into lookups/ldap.c, I came to the conclusion that the call to ldap_parse_url was not functioning correctly.
This reminded me that several years ago I had questions Sun as to why they were shipping ldap commands with the OS that did not support were not as current as the commands that came with their SunOne LDAP server, so I modified the local/Makefile to include the directory for the SunOne LDAP server include files and libraries, rather than relying on the default files that come with Solaris 10.
gray@gb0882ldaptst01:~/work/exim-4.76/Local$ diff Makefile Makefile.1308221538
6c6
< INCLUDE=-I/opt/directory/5.2/servers/plugins/slapd/slapi/include -I/usr/local/BerkeleyDB/include
---
> INCLUDE=-I/usr/local/BerkeleyDB/include
8c8
< DBMLIB=-ldb -L/opt/directory/5.2/servers/lib -L/usr/local/BerkeleyDB/lib/ -R /usr/local/BerkeleyDB/lib/
---
> DBMLIB=-ldb -L/usr/local/BerkeleyDB/lib/ -R /usr/local/BerkeleyDB/lib/
gray@gb0882ldaptst01:~/work/exim-4.76/Local$
and then the ldapsearches work.
exim -C /tmp/dgs.exim -bt dgraystephens@???
dgraystephens@???
<-- dgraystephens@???
router = dnslookup, transport = remote_smtp
host nl0230exchub.mail.slb.com [199.6.133.5] MX=100
host nl0230exchub.mail.slb.com [199.6.132.5] MX=100
host nl0230exchub.mail.slb.com [199.6.132.7] MX=100
host nl0230exchub.mail.slb.com [199.6.133.7] MX=100
Douglas.
--
================================
Dr. Douglas GRAY STEPHENS
Directory Services Manager
Schlumberger Gould Research
High Cross,
Madingley Road,
Cambridge.
CB3 0EL
ENGLAND
Tel:+44-1223-325295<tel:+44-1223-325295> (Office)
Tel:+44-773-0051628<tel:+44-773-0051628> (Mobile)
Fax +44-1223-311830
Email DGrayStephens@???
Registered Name: Schlumberger Oilfield UK Plc
Registered Office: Victory House, Churchill Court, Manor Royal, Crawley, West Sussex, RH10 9LU
Registered in England and Wales No. 4157867
================================
From: Douglas Gray Stephens
Sent: Mon 29 July 2013 09:54
To: Exim-users
Cc: Prashanth Katuri (PKaturi@???)
Subject: Re: [exim] exim-4.80.1 testing issues
On 2013-07-27 21:02, Todd Lyons wrote:
Author: Todd Lyons
Date: 2013-07-27 22:02 +100
To: Jeremy Harris
CC: exim-users
Subject: Re: [exim] exim-4.80.1 testing issues
On Thu, Jul 25, 2013 at 12:45 PM, Jeremy Harris <jgh@???> wrote:
> On 25/07/13 18:01, Prashanth Katuri wrote:
>> key="ldap:///o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=pkaturi))"
Shouldn't that be ldap://HOSTNAME:PORT/o=slb,c=blah...
>> perform_ldap_search: ldapm URL =
>> "ldap:///o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=pkaturi))"
>> server=gb0135ldap00.ldap.slb.com port=390 sizelimit=0 timelimit=0 tcplimit=0
>> after ldap_url_parse: host=o=slb,c=an port=954024
You can see that at first something in his config had a servername
that appeared to be a valid hostname, but then after parsing the URL
to extract the host/port, it was not specified so it resulted in
nothing.
The bus error...isn't that due to free'ing a constant string?
...Todd
The configuration file defines ldap_default_servers:
ldap_default_servers = "\
gb0135ldap00.ldap.slb.com::390"
so the URL correctly substitutes this, and expands, but then after ldap_url_parse one sees the wrong host and port
LDAP parameters: user=NULL pass=NULL size=0 time=0 connect=0 dereference=0 referrals=on
perform_ldap_search: ldapm URL = "ldap:///o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=pkaturi))" server=gb0135ldap00.ldap.slb.com port=390 sizelimit=0 timelimit=0 tcplimit=0
after ldap_url_parse: host=o=slb,c=an port=954024
Hard coding the hostname into the LDAP URL, one gets a slightly different response (no bus error, but still an error in the LDAP URL parsing):
internal_search_find: file="NULL"
type=ldap key="ldap://gb0135ldap00.ldap.slb.com:390/o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=dgraystephens))"
database lookup required for ldap://gb0135ldap00.ldap.slb.com:390/o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=dgraystephens))
LDAP parameters: user=NULL pass=NULL size=0 time=0 connect=0 dereference=0 referrals=on
perform_ldap_search: ldap URL = "ldap://gb0135ldap00.ldap.slb.com:390/o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=dgraystephens))" server=NULL port=0 sizelimit=0 timelimit=0 tcplimit=0
after ldap_url_parse: host=o=slb,c=an port=954024
failed to initialize for LDAP server o=slb,c=an:954024 - Invalid argument
lookup deferred: failed to initialize for LDAP server o=slb,c=an:954024 - Invalid argument
condition check lookup defer
dgraystephens@???<
mailto:dgraystephens@slb.com> cannot be resolved at this time: condition check lookup defer
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=15198 terminating with rc=1 >>>>>>>>>>>>>>>>
Running the same configuration on a Ubuntu box (rather than Solaris), and the search works
gray@gray-scr2-linux:~$ exim -C /tmp/dgs.exim -d+lookup -bt dgraystephens@???<
mailto:dgraystephens@slb.com>
Exim version 4.76 uid=1000 gid=1000 pid=30750 D=fbb95cfd
Berkeley DB: Berkeley DB 5.1.25: (January 28, 2011)
Support for: crypteq iconv() IPv6 PAM Perl Expand_dlfunc GnuTLS move_frozen_messages Content_Scanning DKIM Old_Demime
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl dovecot plaintext spa
Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Compiler: GCC [4.6.3]
Library version: GnuTLS: Compile: 2.12.14
Runtime: 2.12.14
Library version: Cyrus SASL: Compile: 2.1.25
Runtime: 2.1.25 [Cyrus SASL]
Library version: PCRE: Compile: 8.12
Runtime: 8.12 2011-01-15
Total 18 lookups
Library version: MySQL: Compile: 5.5.28 [(Ubuntu)]
Runtime: 5.5.31
Library version: SQLite: Compile: 3.7.9
Runtime: 3.7.9
<snip>
internal_search_find: file="NULL"
type=ldapm key="ldap:///o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=dgraystephens))"
database lookup required for ldap:///o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=dgraystephens))
LDAP parameters: user=NULL pass=NULL size=0 time=0 connect=0 dereference=0 referrals=on
perform_ldap_search: ldapm URL = "ldap:///o=slb,c=an?alias,mail,cn,ou,telephonenumber,o?sub?(&(mail=*)(alias=dgraystephens))" server=gb0135ldap00.ldap.slb.com port=390 sizelimit=0 timelimit=0 tcplimit=0
after ldap_url_parse: host=gb0135ldap00.ldap.slb.com port=390
ldap_initialize with URL ldap://gb0135ldap00.ldap.slb.com:390/
initialized for LDAP (v3) server gb0135ldap00.ldap.slb.com:390
LDAP_OPT_X_TLS_TRY set
binding with user=NULL password=NULL
Start search
ldap_result loop
LDAP entry loop
LDAP attr loop alias:dgraystephens
The Solaris version was compiled from source using Exim 4.80.1, while the Ubuntu package was installed as a package, and is based on 4.76. I do not see anything explicitly mentioned for LDAP lookups in the exim 4.80 change logs, but there has been changes to the lookups (new type dbmjz)
Regards,
Douglas.
--
================================
Dr. Douglas GRAY STEPHENS
Directory Services Manager
Schlumberger Gould Research
High Cross,
Madingley Road,
Cambridge.
CB3 0EL
ENGLAND
Tel:+44-1223-325295<tel:+44-1223-325295> (Office)
Tel:+44-773-0051628<tel:+44-773-0051628> (Mobile)
Fax +44-1223-311830
Email DGrayStephens@???<
mailto:DGrayStephens@slb.com>
Registered Name: Schlumberger Oilfield UK Plc
Registered Office: Victory House, Churchill Court, Manor Royal, Crawley, West Sussex, RH10 9LU
Registered in England and Wales No. 4157867
================================