]> git.sur5r.net Git - openldap/blobdiff - libraries/liblber/options.c
ITS#2657: authzid (and assertion) should apply to most everything
[openldap] / libraries / liblber / options.c
index 4ecee6485b60ba336591558a61820f76ad39647f..d2371567e706a781d6b6ecc4c063bb26967e2c18 100644 (file)
 #include <ac/stdarg.h>
 #include "lber-int.h"
 
+char ber_pvt_opt_on;   /* used to get a non-NULL address for *_OPT_ON */
+
 struct lber_options ber_int_options = {
-       LBER_UNINITIALIZED, 0, 0 };
+       LBER_UNINITIALIZED, 0, 0, 0 };
 
 int
 ber_get_option(
@@ -86,6 +88,11 @@ ber_get_option(
                *((ber_len_t *) outvalue) = ber_pvt_ber_write(ber);
                return LBER_OPT_SUCCESS;
 
+       case LBER_OPT_BER_MEMCTX:
+               assert( LBER_VALID( ber ) );
+               *((void **) outvalue) = ber->ber_memctx;
+               return LBER_OPT_SUCCESS;
+       
        default:
                /* bad param */
                ber_errno = LBER_ERROR_PARAM;
@@ -121,7 +128,7 @@ ber_set_option(
                }
 
                ber_int_memory_fns = (BerMemoryFunctions *)
-                       (*(f->bmf_malloc))(sizeof(BerMemoryFunctions));
+                       (*(f->bmf_malloc))(sizeof(BerMemoryFunctions), NULL);
 
                if ( ber_int_memory_fns == NULL ) {
                        ber_errno = LBER_ERROR_MEMORY;
@@ -204,6 +211,11 @@ ber_set_option(
                ber->ber_ptr = &ber->ber_buf[* (const ber_len_t *) invalue];
                return LBER_OPT_SUCCESS;
 
+       case LBER_OPT_BER_MEMCTX:
+               assert( LBER_VALID( ber ) );
+               ber->ber_memctx = *(void **)invalue;
+               return LBER_OPT_SUCCESS;
+
        default:
                /* bad param */
                ber_errno = LBER_ERROR_PARAM;