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

Re: struct ldap empty



> The current -devel tree has moved struct ldap to a private include file.
> 
> The current best LDAP documentation (Tim Howes book) gives specific instructions 
> and examples that are based on the documented differences between UMich and Netscape.
> 
> For example,  with netscape you call ldap_get_lderrno() but reference
> ld->ld_errno with UMich. 
> 
> A fair bit of code will use the following (adapted/stolen from page 85):
> 
> 	#ifdef LDAP_OPT_SIZELIMIT	/* only defined in Netscape SDK */
> 	errno = ldap_get_lderrno(ld, NULL, NULL);
> 	#else
> 	errno = ld->ld_errno;
> 	#endif
> 
> This code is now broken if you attempt to compile it against openldap..
> 
> As a quick initial fix I have done a quick pass at ldap_get_lderrno() and
> commited it to the -devel tree. 
> 
> I don't know what other implications there are with adding
> LDAP_OPT_SIZELIMIT (what other Netscapism's are people using it to select?)
> so I havn't attempted to add LDAP_OPT_SIZELIMIT to ldap.h.
> 
> -- 
> Stuart Lynne <sl@fireplug.net>      604-461-7532      <http://www.fireplug.net>
> PGP Fingerprint: 28 E2 A0 15 99 62 9A 00  88 EC A3 EE 2D 1C 15 68
> 

I just joined this list yesterday, but here I go with both feet.
I used the following in writing a Tcl interface to LDAP that works
with both Umich and Netscape SDK:

#ifdef UMICH_LDAP
#define ldap_memfree(p) free(p)
#define ldap_ber_free(p, n) ber_free(p, n)
#define ldap_get_lderrno(ld, dummy1, dummy2) (ld->ld_errno)
#define ldap_value_free_len(bvals) ber_bvecfree(bvals)
#define ldap_attributefree(p)
#else
#define ldap_attributefree(p) ldap_memfree(p)
#endif
#define LDAP_ERR_STRING(ld)  \
        ldap_err2string(ldap_get_lderrno(ldap, (char**)NULL, (char**)NULL))
 

My reasoning for not using something like LDAP_OPT_SIZELIMIT is the fact
that a macro added to the Umich LDAP handles it perfectly, so why bring
in another name.  Perhaps this grates against some programmers who would
say that a macro must be all upper case, but I don't such a requirement
is appropriate here.

One thing that is missing from the above code is the fact that I have to
figure out which ldap.h I got, thus the need for my -DUMICH_LDAP when I
compile.  Such a define as VENDOR_UMICH_LDAP, or VENDOR_OPEN_LDAP in ldap.h,
would be very useful in configure scripts.

In the case where Netscape APIs can be implemented perfectly using macros,
why not just add them to ldap.h?

Randy Kunkee
NeoSoft Inc.