index files clean.
LDAPMod *mod = &ml->ml_mod;
switch ( mod->mod_op & ~LDAP_MOD_BVALUES ) {
- case LDAP_MOD_ADD:
case LDAP_MOD_REPLACE:
+ /* XXX: Delete old index data==>problem when this
+ * gets called we lost values already!
+ */
+ case LDAP_MOD_ADD:
rc = index_add_values( be, mod->mod_type,
mod->mod_bvalues, id );
break;
- case LDAP_MOD_SOFTADD: /* SOFTADD means index was there */
case LDAP_MOD_DELETE:
+ rc = index_delete_values( be, mod->mod_type,
+ mod->mod_bvalues, id );
+ break;
+ case LDAP_MOD_SOFTADD: /* SOFTADD means index was there */
rc = 0;
break;
}
return( rc );
}
+/* Remove entries from index files */
+
+int
+index_delete_values(
+ Backend *be,
+ char *type,
+ struct berval **vals,
+ ID id
+)
+{
+
+ return 0;
+
+}
+
int
index_add_values(
Backend *be,
int err;
LDAPMod *mod;
LDAPModList *ml;
+ Attribute *a;
if ( ((be->be_lastmod == ON)
|| ((be->be_lastmod == UNDEFINED)&&(global_lastmod == ON)))
break;
case LDAP_MOD_REPLACE:
+ /* Need to remove all values from indexes before they
+ * are lost.
+ */
+ if( e->e_attrs
+ && ((a = attr_find( e->e_attrs, mod->mod_type ))
+ != NULL) ) {
+
+ (void) index_delete_values( be, mod->mod_type,
+ a->a_vals, e->e_id );
+ }
+
err = replace_values( e, mod, op->o_ndn );
break;
char *dn
)
{
+
+ /* XXX: BEFORE YOU GET RID OF PREVIOUS VALUES REMOVE FROM INDEX
+ * FILES
+ */
+
(void) attr_delete( &e->e_attrs, mod->mod_type );
if ( attr_merge( e, mod->mod_type, mod->mod_bvalues ) != 0 ) {
int index_add_mods LDAP_P(( Backend *be, LDAPModList *ml, ID id ));
ID_BLOCK * index_read LDAP_P(( Backend *be, char *type, int indextype, char *val ));
int index_add_values LDAP_P(( Backend *be, char *type, struct berval **vals, ID id ));
+int index_delete_values LDAP_P(( Backend *be, char *type, struct berval **vals, ID id ));
/*
* kerberos.c