Lines 552-568
int mdb_entry_release(
|
Link Here
|
---|
|
552 |
{ |
552 |
{ |
553 |
struct mdb_info *mdb = (struct mdb_info *) op->o_bd->be_private; |
553 |
struct mdb_info *mdb = (struct mdb_info *) op->o_bd->be_private; |
554 |
struct mdb_op_info *moi = NULL; |
554 |
struct mdb_op_info *moi = NULL; |
|
|
555 |
int release = 1; |
555 |
|
556 |
|
556 |
/* slapMode : SLAP_SERVER_MODE, SLAP_TOOL_MODE, |
557 |
/* slapMode : SLAP_SERVER_MODE, SLAP_TOOL_MODE, |
557 |
SLAP_TRUNCATE_MODE, SLAP_UNDEFINED_MODE */ |
558 |
SLAP_TRUNCATE_MODE, SLAP_UNDEFINED_MODE */ |
558 |
|
559 |
|
559 |
int release = 1; |
|
|
560 |
if ( slapMode & SLAP_SERVER_MODE ) { |
560 |
if ( slapMode & SLAP_SERVER_MODE ) { |
561 |
OpExtra *oex; |
561 |
OpExtra *oex; |
|
|
562 |
|
563 |
/* Only Add ops call with rw set, and in that case the entry |
564 |
* was not created by the backend. So always just release it. |
565 |
* |
566 |
* Otherwise, the entry was read from a backend, and we need |
567 |
* to be sure it was read from this backend, otherwise leave |
568 |
* it alone for someone else to release. |
569 |
*/ |
562 |
LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) { |
570 |
LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) { |
563 |
release = 0; |
|
|
564 |
if ( oex->oe_key == mdb ) { |
571 |
if ( oex->oe_key == mdb ) { |
565 |
mdb_entry_return( op, e ); |
|
|
566 |
moi = (mdb_op_info *)oex; |
572 |
moi = (mdb_op_info *)oex; |
567 |
/* If it was setup by entry_get we should probably free it */ |
573 |
/* If it was setup by entry_get we should probably free it */ |
568 |
if (( moi->moi_flag & (MOI_FREEIT|MOI_KEEPER)) == MOI_FREEIT ) { |
574 |
if (( moi->moi_flag & (MOI_FREEIT|MOI_KEEPER)) == MOI_FREEIT ) { |
Lines 577-588
int mdb_entry_release(
|
Link Here
|
---|
|
577 |
break; |
583 |
break; |
578 |
} |
584 |
} |
579 |
} |
585 |
} |
|
|
586 |
/* If read, other backends were in use, and not ours, don't release */ |
587 |
if ( !rw && ( LDAP_SLIST_FIRST( &op->o_extra ) && !oex )) |
588 |
release = 0; |
580 |
} |
589 |
} |
581 |
|
590 |
|
582 |
if (release) |
591 |
if (release) |
583 |
mdb_entry_return( op, e ); |
592 |
mdb_entry_return( op, e ); |
584 |
|
593 |
|
585 |
return 0; |
594 |
return release ? 0 : SLAP_CB_CONTINUE; |
586 |
} |
595 |
} |
587 |
|
596 |
|
588 |
/* return LDAP_SUCCESS IFF we can retrieve the specified entry. |
597 |
/* return LDAP_SUCCESS IFF we can retrieve the specified entry. |
589 |
- |
|
|