#include <sys/socket.h>
#include "slap.h"
#include "back-ldbm.h"
+#include "proto-back-ldbm.h"
extern int global_schemacheck;
-extern Entry *dn2entry();
extern Attribute *attr_find();
static int add_values();
int i, err, modtype;
LDAPMod *mod;
- if ( (e = dn2entry( be, dn, &matched )) == NULL ) {
+ Debug(LDAP_DEBUG_ARGS, "ldbm_back_modify:\n", 0, 0, 0);
+
+ if ( (e = dn2entry_w( be, dn, &matched )) == NULL ) {
send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched,
NULL );
if ( matched != NULL ) {
}
return( -1 );
}
+
+ /* check for deleted */
+
/* lock entry */
if ( (err = acl_check_mods( be, conn, op, e, mods )) != LDAP_SUCCESS ) {
send_ldap_result( conn, op, err, NULL, NULL );
- cache_return_entry( &li->li_cache, e );
- return( -1 );
+ goto error_return;
}
for ( mod = mods; mod != NULL; mod = mod->mod_next ) {
}
}
+ /* check that the entry still obeys the schema */
+ if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
+ Debug( LDAP_DEBUG_ANY, "entry failed schema check\n", 0, 0, 0 );
+ send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, NULL, NULL );
+ goto error_return;
+ }
+
/* check for abandon */
pthread_mutex_lock( &op->o_abandonmutex );
if ( op->o_abandon ) {
}
pthread_mutex_unlock( &op->o_abandonmutex );
- /* check that the entry still obeys the schema */
- if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
- Debug( LDAP_DEBUG_ANY, "entry failed schema check\n", 0, 0, 0 );
- send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, NULL, NULL );
- goto error_return;
- }
-
/* modify indexes */
if ( index_add_mods( be, mods, e->e_id ) != 0 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
}
send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
- cache_return_entry( &li->li_cache, e );
-
+ cache_return_entry_w( &li->li_cache, e );
return( 0 );
error_return:;
- cache_delete_entry( &li->li_cache, e );
- cache_return_entry( &li->li_cache, e );
-
+ cache_return_entry_w( &li->li_cache, e );
return( -1 );
}