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

Simple questions about ldap_controls_free, ber_flatten2, ber_printf formats



Hello all,

I've got some questions I couldn't find an answer for in
draft-ietf-ldapext-ldap-c-api-xx.txt.

1) Is ldap_controls_free(0) supposed to work (say like the runtime's
   free(0))?  The implementation is somewhat perplexing me because in
   a debug build it will crash (assert) but in a release build it will
   do ('if'-statement).

2) I'm using ber_flatten2 similarly to the following code:

   ber_printf(ber, "{iON}", size, &cookie);
   ber_flatten2(ber, &val, 0);

   What makes me a bit nervous is that ber_flatten2 assumes that it
   can write an additional \x0 to the end of the internal buffer of
   BerElement 'ber' when I don't want the result to be allocated
   (third parameter is 0).  How can I assure that this extra byte is
   always there?

3) To be honest I have copied the above format string for ber_printf
   from Luke Howard's page control implementation in nss_ldap.  I've
   verified that it works but I don't understand the 'N' format
   specifier.  On one hand I don't understand why an ASN.1 null should
   be useful at all as it is not specified in RFC 2696, OTOH it uses
   'N' instead of the documented 'n'.  Could you enlighten me a bit?


TIA,

aa

-- 
Andreas Ames | Programmer | Comergo GmbH | 
Voice:  +49 69 7505 3213 | andreas . ames AT comergo . com