Re: [EXIM] LDAP lookup problems, 2nd part

Top Page
Delete this message
Reply to this message
Author: James FitzGibbon
Date:  
To: michael
CC: exim-users
Subject: Re: [EXIM] LDAP lookup problems, 2nd part
* michael@??? (michael@???) [990408 13:11]:

> Finally I succeeded to reproduce the second problem I mentioned in my
> last mail and I can now reproduce a bug with looking up an optional and
> in this case non-existant attribute of an entry:
>
> Re-using cached connection to directory server for ldap://ldap.mydomain.de/dc=domain,dc=maildomain,o=myorg?forwardto
>
> There is an entry with this DN, but it has no forwardto attribute. Ok so far.
>
> perform_ldap_search: LDAP entry loop
>
> Ok, we are in the loop now.
>
> perform_ldap_search: LDAP exit entry loop data: dc=maildomain,o=myorg?mailbox
>
> We left the loop, there was nothing found, but we still have a result.
> To me, it looks like data (src/lookups/ldap.c:246 and :324) is returned
> allocated but never got initialised. Does the library indeed return an
> entry with no attributes for the above query?


I had problems with this too, but I thought that it was due to our in-house
code that populated LDAP based upon Oracle data. Our converter was
inserting atributes with blank values instead of just skipping the
attribute. Exim was pulling back the blank value (since blank is
technically a value in LDAP), but when it use the value in an expansion,
everything blew up.

I fixed this locally like this:

--START--
/* If the resultant LDAP return string is empty, pretend like the query
failed */

if( strlen( data ) == 0 ) {
    DEBUG(9) debug_printf("perform_ldap_search: LDAP search returned a null value string\n" );
    return( FAIL );
}


DEBUG(9) debug_printf("perform_ldap_search: LDAP exit entry loop data: %s\n",
    (data)?(data):(""));


*res = data;
return OK;
}
---END---

at the end of perform_ldap_search. I hadn't shared this with this list as I
thought that it was specific to my site.


--
j.

James FitzGibbon (JF647)                                        james@???
EHLO Solutions                                         Voice/Fax (416)410-0100


--
*** Exim information can be found at http://www.exim.org/ ***