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

Re: Bad assertion in getdn.c for libldap (ITS#2338)



> Full_Name: Quanah Gibson-Mount
> Version: 2.1.13
> OS: Solaris
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (171.66.182.82)
>
>
> Hello,
>
> In evaluating a script that had run fine when using Net::LDAPapi
> compiled against the old Netscape libraries with Symas' Net::LDAPapi &
> OpenLDAP libraries from 2.1.13, I found that it now fails due to a
> failed assertion in getdn.c for libldap at line 93.
>
> The script simply makes an anonymous bind to our Netscape directory
> servers & does a query on the cn=monitor piece.  It gets as far as
> performing the search before returning the error:
>
> perl ldap.monitor directory1.stanford.edu
> getdn.c:93: failed assertion `ld != NULL'
> Abort

the assert is in

int ldap_get_dn(LDAP *ld, LDAPMessage *entry)

which must be called with a valid ld (e.g. pointing
at the connection that returned entry); apparently
this is not happening, so your client may be hosed.

>From IETF draft "C LDAP Application Program Interface":

ldap_get_dn() will return NULL if there is some error parsing the dn,
setting error parameters in the session handle ld to indicate the error.
It returns a pointer to newly allocated space that the caller SHOULD
free by calling ldap_memfree() when it is no longer in use.  Note the
format of the DNs returned is given by [5].  The root DN is returned as
a zero length string ("").

Apparently, since the function must be able to set the error
parameters in the session handle, if required, then ld must be
valid.

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it