[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re[2]: getting dn from ldap_search_ext_s



Hey Pierangelo,


Thursday, August 09, 2001, 3:17:27 AM, you wrote:

PM> "Kevin J. Menard, Jr." wrote:
>> 
>> Hey openldap-software,
>> 
>>   Ok, what's the best way to just get the dn from a search?
>> 
>>   Pass LDAP_NO_ATTRS or "1.1" as the fifth argument, 

PM> this

>> or build a character
>>   array ptr like char *attributes[] = {"dn", NULL}; ?

PM> This doesn't work: "dn" is not a regular attribute.

Argh.  I seem to be finding the exact opposite.  I segfault when I use
LDAP_NO_ATTRS.  Here's the gdb bt output:

Program received signal SIGSEGV, Segmentation fault.
0x40331acd in ber_put_string () from /usr/lib/liblber.so.2
(gdb) bt
#0  0x40331acd in ber_put_string () from /usr/lib/liblber.so.2
#1  0x40332777 in ber_printf () from /usr/lib/liblber.so.2
#2  0x40310f4e in ldap_build_search_req () from /usr/lib/libldap.so.2
#3  0x40310c08 in ldap_search_ext () from /usr/lib/libldap.so.2
#4  0x40310cd1 in ldap_search_ext_s () from /usr/lib/libldap.so.2

I'm assuming the ber struct in ldap_search_ext is causing problems when
being freed or something.

However, if I do char *attributes[] = {"dn", NULL}; and use that instead of
LDAP_NO_ATTRS, it doesn't segfault; it works fine.

Here's the offending function call:

ldap_search_ext_s(ld, ldap_basedn, LDAP_SCOPE_SUBTREE, filter,
                          LDAP_NO_ATTRS, 0, NULL, NULL, LDAP_NO_LIMIT, 1,
                          &result);

(yes, i'm checking return types, but I'm just simplifying this here.)

Thanks.

-- 
 Kevin