Commit dd687051 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

quick fix to allow -DSLAP_NVALUES with -DLDAP_SLAPI

parent 216bcd94
......@@ -292,6 +292,9 @@ freeMods( Modifications *ml )
next = ml->sml_next;
slapi_ch_free( (void **)&ml->sml_bvalues );
#ifdef SLAP_NVALUES
slapi_ch_free( (void **)&ml->sml_nvalues );
#endif
slapi_ch_free( (void **)&ml );
}
}
......@@ -356,6 +359,9 @@ LDAPModToEntry(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
......@@ -364,6 +370,9 @@ LDAPModToEntry(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
*modtail = mod;
modtail = &mod->sml_next;
......@@ -379,6 +388,9 @@ LDAPModToEntry(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
......@@ -387,6 +399,9 @@ LDAPModToEntry(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
*modtail = mod;
modtail = &mod->sml_next;
......@@ -932,6 +947,9 @@ slapi_modify_internal(
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *)ch_malloc( sizeof(Modifications) );
......@@ -940,12 +958,18 @@ slapi_modify_internal(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
} else {
rc = values2obj( pMod->mod_values, &bv );
if ( rc != LDAP_SUCCESS ) goto cleanup;
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
#ifdef SLAP_NVALUES
tmp.sml_nvalues = NULL;
#endif
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
......@@ -954,6 +978,9 @@ slapi_modify_internal(
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod->sml_bvalues = tmp.sml_bvalues;
#ifdef SLAP_NVALUES
mod->sml_nvalues = tmp.sml_nvalues;
#endif
}
*modtail = mod;
modtail = &mod->sml_next;
......
......@@ -556,15 +556,20 @@ slapi_entry_add_values( Slapi_Entry *e, const char *type, struct berval **vals )
}
if ( vals == NULL ) {
/* Apparently vals can be NULL */
/* Apparently vals can be NULL
* FIXME: sm_bvalues = NULL ? */
mod.sm_bvalues = (BerVarray)ch_malloc( sizeof(struct berval) );
mod.sm_bvalues->bv_val = NULL;
} else {
rc = bvptr2obj( vals, &mod.sm_bvalues );
if ( rc != LDAP_SUCCESS ) {
return LDAP_CONSTRAINT_VIOLATION;
}
}
#ifdef SLAP_NVALUES
mod.sm_nvalues = NULL;
#endif
rc = modify_add_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) );
......@@ -638,6 +643,9 @@ slapi_entry_delete_values( Slapi_Entry *e, const char *type, struct berval **val
if ( rc != LDAP_SUCCESS ) {
return LDAP_CONSTRAINT_VIOLATION;
}
#if SLAP_NVALUES
mod.sm_nvalues = NULL;
#endif
rc = modify_delete_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) );
......@@ -3144,6 +3152,9 @@ Modifications *slapi_x_ldapmods2modifications (LDAPMod **mods)
}
mod->sml_bvalues[i].bv_val = NULL;
}
#ifdef SLAP_NVALUES
mod->sml_nvalues = NULL;
#endif
*modtail = mod;
modtail = &mod->sml_next;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment