mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
Added modify race patch from sl@fireplug.net
This commit is contained in:
parent
f7b5714171
commit
48dcea21a1
@ -64,8 +64,7 @@ ldbm_back_modify(
|
|||||||
if ( err != LDAP_SUCCESS ) {
|
if ( err != LDAP_SUCCESS ) {
|
||||||
/* unlock entry, delete from cache */
|
/* unlock entry, delete from cache */
|
||||||
send_ldap_result( conn, op, err, NULL, NULL );
|
send_ldap_result( conn, op, err, NULL, NULL );
|
||||||
cache_return_entry( &li->li_cache, e );
|
goto error_return;
|
||||||
return( -1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,46 +72,47 @@ ldbm_back_modify(
|
|||||||
pthread_mutex_lock( &op->o_abandonmutex );
|
pthread_mutex_lock( &op->o_abandonmutex );
|
||||||
if ( op->o_abandon ) {
|
if ( op->o_abandon ) {
|
||||||
pthread_mutex_unlock( &op->o_abandonmutex );
|
pthread_mutex_unlock( &op->o_abandonmutex );
|
||||||
cache_return_entry( &li->li_cache, e );
|
goto error_return;
|
||||||
return( -1 );
|
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock( &op->o_abandonmutex );
|
pthread_mutex_unlock( &op->o_abandonmutex );
|
||||||
|
|
||||||
/* check that the entry still obeys the schema */
|
/* check that the entry still obeys the schema */
|
||||||
if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
|
if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
|
||||||
send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, NULL,
|
Debug( LDAP_DEBUG_ANY, "entry failed schema check\n", 0, 0, 0 );
|
||||||
NULL );
|
send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, NULL, NULL );
|
||||||
cache_return_entry( &li->li_cache, e );
|
goto error_return;
|
||||||
return( -1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* modify indexes */
|
/* modify indexes */
|
||||||
if ( index_add_mods( be, mods, e->e_id ) != 0 ) {
|
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_OPERATIONS_ERROR, NULL, NULL );
|
||||||
cache_return_entry( &li->li_cache, e );
|
goto error_return;
|
||||||
return( -1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for abandon */
|
/* check for abandon */
|
||||||
pthread_mutex_lock( &op->o_abandonmutex );
|
pthread_mutex_lock( &op->o_abandonmutex );
|
||||||
if ( op->o_abandon ) {
|
if ( op->o_abandon ) {
|
||||||
pthread_mutex_unlock( &op->o_abandonmutex );
|
pthread_mutex_unlock( &op->o_abandonmutex );
|
||||||
cache_return_entry( &li->li_cache, e );
|
goto error_return;
|
||||||
return( -1 );
|
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock( &op->o_abandonmutex );
|
pthread_mutex_unlock( &op->o_abandonmutex );
|
||||||
|
|
||||||
/* change the entry itself */
|
/* change the entry itself */
|
||||||
if ( id2entry_add( be, e ) != 0 ) {
|
if ( id2entry_add( be, e ) != 0 ) {
|
||||||
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
|
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
|
||||||
cache_return_entry( &li->li_cache, e );
|
goto error_return;
|
||||||
return( -1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
|
send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
|
||||||
cache_return_entry( &li->li_cache, e );
|
cache_return_entry( &li->li_cache, e );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
|
||||||
|
error_return:;
|
||||||
|
cache_delete_entry( &li->li_cache, e );
|
||||||
|
cache_return_entry( &li->li_cache, e );
|
||||||
|
|
||||||
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user