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

Re: Functions does not catch NULL (ITS#1769)


Good point, but there should be a way to install a handler for these
functions. As long as we do not have C++ classes, which makes exceptions
possible it would be nice to catch these errors.


----- Original Message -----
From: "Pierangelo Masarati" <openldap-its@OpenLDAP.org>
To: <cp@c-note.dk>
Sent: Friday, April 26, 2002 09:58
Subject: Re: Functions does not catch NULL (ITS#1769)

> > Even if LDAP* is NULL, the ldap function still tries to contact the LDAP
> server.
> > Which result in a assert failure:
> > search.c:219 ldap_search: Assertion `( (ld)->ld_options.ldo_valid ==
> > failed
> I don't see any good reason for continuing a program when LDAP* is NULL;
> you should catch this case well before any of the ldap_search* functions
> are caught (that's why there's an assertion there).  Note that
> draft-ietf-ldapext-ldap-c-api does not say anything about calling any
> API function with a NULL handler __EXCEPT__ for ldap_set_option(), in
> which case __GLOBAL__ options are affected.  Any other consideration is
> a matter of programming style: assertions vs. silent acceptance of
> illegal conditions; OpenLDAP code is filled of assertions to catch flaws
> as early as they show up.
> Pierangelo.