Make first argument of *_get_option const (experimental).

Make _MOD_SOFTADD 0x1000 to minimize chance of conflict with legit changes
to API spec.
Fix memory leak in ldap_mods_free() and minor memory allocator issues.
This commit is contained in:
Kurt Zeilenga 1999-06-02 21:38:48 +00:00
parent 09fe2bc905
commit bed6465529
7 changed files with 26 additions and 18 deletions

View File

@ -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));

View File

@ -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));

View File

@ -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 ));

View File

@ -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:

View File

@ -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] );
}

View File

@ -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();

View File

@ -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