X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldbm%2Fmodify.c;h=df9414673648bb609383319d89d8c3ae97c2dfee;hb=4a5d740e2ee4e700e76b2eac6f079e39f0134c94;hp=84f6f109dc672ddb516efafd7d248a183303d37e;hpb=4caf68cf43bbbbf24a4e5db62343564bb6d99714;p=openldap diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 84f6f109dc..df94146736 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -6,9 +6,9 @@ #include #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(); @@ -30,7 +30,9 @@ ldbm_back_modify( 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 ) { @@ -38,12 +40,14 @@ ldbm_back_modify( } 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 ) { @@ -68,6 +72,13 @@ ldbm_back_modify( } } + /* 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 ) { @@ -76,13 +87,6 @@ ldbm_back_modify( } 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 ); @@ -104,14 +108,11 @@ ldbm_back_modify( } 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 ); }