diff --git a/include/lber.h b/include/lber.h index 9d3db08e2e1efc93df91ced470c5ff7d071e8a9b..e4f3178d1e11b5f2f3eae1f130f5d8504313ff00 100644 --- a/include/lber.h +++ b/include/lber.h @@ -396,7 +396,7 @@ ber_flatten LDAP_P(( LDAP_F( int ) ber_get_option LDAP_P(( - void *item, + LDAP_CONST void *item, int option, void *outvalue)); diff --git a/include/ldap.h b/include/ldap.h index d1d5008bce4c16874c25aa49c58c2e3d17778aac..2092565bd7f63292d12b99c88a91db03af92fef7 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -318,11 +318,12 @@ typedef struct ldapmod { #define LDAP_MOD_ADD 0x0000 #define LDAP_MOD_DELETE 0x0001 #define LDAP_MOD_REPLACE 0x0002 -/* IMPORTANT: do not use code 0x04, it is used internally by the backends! +#define LDAP_MOD_BVALUES 0x0080 +/* IMPORTANT: do not use code 0x1000 (or above), + * it is used internally by the backends! * (see ldap/servers/slapd/slap.h) * JCG 05/1999 (gomez@engr.sgi.com) */ -#define LDAP_MOD_BVALUES 0x0080 char *mod_type; union mod_vals_u { char **modv_strvals; @@ -506,7 +507,7 @@ struct timeval; */ LDAP_F( int ) ldap_get_option LDAP_P(( - LDAP *ld, + LDAP_CONST LDAP *ld, int option, void *outvalue)); diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index 2a8349aff663928fb9aca08535196607ece1eaee..8cb299ef95c4e5b23348660cb078eb9630495afa 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -216,8 +216,8 @@ ber_pvt_sb_init LDAP_P(( Sockbuf *sb )); LDAP_F( int ) ber_pvt_sb_destroy LDAP_P(( Sockbuf *sb )); -#ifdef USE_SASL +#ifdef USE_SASL LDAP_F( int ) ber_pvt_sb_set_sec LDAP_P(( Sockbuf *sb, Sockbuf_Sec *sec, void *arg )); diff --git a/libraries/liblber/options.c b/libraries/liblber/options.c index 863f9396d5792e19e1146e2a2f8a6ff03675c181..a323bbee963504ddbb8a36b8ed972748fd6cfc11 100644 --- a/libraries/liblber/options.c +++ b/libraries/liblber/options.c @@ -14,12 +14,12 @@ struct lber_options ber_int_options = { int ber_get_option( - void *item, + LDAP_CONST void *item, int option, void *outvalue) { - BerElement *ber; - Sockbuf *sb; + LDAP_CONST BerElement *ber; + LDAP_CONST Sockbuf *sb; ber_int_options.lbo_valid = LBER_INITIALIZED; @@ -37,8 +37,8 @@ ber_get_option( return LBER_OPT_ERROR; } - ber = (BerElement *) item; - sb = (Sockbuf *) item; + ber = item; + sb = item; switch(option) { case LBER_OPT_BER_OPTIONS: @@ -115,8 +115,8 @@ ber_set_option( return LBER_OPT_ERROR; } - ber = (BerElement *) item; - sb = (Sockbuf *) item; + ber = item; + sb = item; switch(option) { case LBER_OPT_BER_OPTIONS: diff --git a/libraries/libldap/free.c b/libraries/libldap/free.c index 2d5b390a16c11d21c21cdbc09285e520c543be7f..ba8c70902b88c10682723b88c25f09f5927691a1 100644 --- a/libraries/libldap/free.c +++ b/libraries/libldap/free.c @@ -106,10 +106,17 @@ ldap_mods_free( LDAPMod **mods, int freemods ) for ( i = 0; mods[i] != NULL; i++ ) { if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) { - ber_bvecfree( mods[i]->mod_bvalues ); - } else { - ldap_value_free( mods[i]->mod_values ); + if( mods[i]->mod_bvalues != NULL ) + ber_bvecfree( mods[i]->mod_bvalues ); + + } else if( mods[i]->mod_values != NULL ) { + LDAP_VFREE( mods[i]->mod_values ); + } + + if ( mods[i]->mod_type != NULL ) { + LDAP_FREE( mods[i]->mod_type ); } + LDAP_FREE( (char *) mods[i] ); } diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index f03382519efc99302895c66eaaba9cd327c501f2..e6596439820639d495af8a8fd871f43a4ebdaede 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -77,11 +77,11 @@ static const LDAPAPIFeatureInfo features[] = { int ldap_get_option( - LDAP *ld, + LDAP_CONST LDAP *ld, int option, void *outvalue) { - struct ldapoptions *lo; + LDAP_CONST struct ldapoptions *lo; if( ldap_int_global_options.ldo_valid != LDAP_INITIALIZED ) { ldap_int_initialize(); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 8f5f692519bf7a4ae3d859aa5031b798eb7792cc..0f5eec9e275b33f863d759a83df0382a66266fb1 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -36,7 +36,7 @@ * modrdn when the new rdn was already an attribute value itself. * JCG 05/1999 (gomez@engr.sgi.com) */ -#define LDAP_MOD_SOFTADD 0x04 +#define LDAP_MOD_SOFTADD 0x1000 #define DN_DNS 0 #define DN_X500 1