mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
Add struct backend_info->bi_entry_release_rw and related functions.
Move cache_return_entry_w() out of ldbm_back_add when the add is successful. This change breaks back-bdb2, it needs equvalent changes of those in back-ldbm.
This commit is contained in:
parent
2182976824
commit
62aa401bd7
@ -127,6 +127,7 @@ do_add( Connection *conn, Operation *op )
|
||||
}
|
||||
if ( (*be->be_add)( be, conn, op, e ) == 0 ) {
|
||||
replog( be, LDAP_REQ_ADD, e->e_dn, e, 0 );
|
||||
be_entry_release_w( be, e );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1,9 +1,9 @@
|
||||
XSRCS = version.c
|
||||
SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c id2entry.c \
|
||||
SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \
|
||||
index.c id2children.c nextid.c abandon.c compare.c group.c \
|
||||
modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
|
||||
filterindex.c unbind.c kerberos.c close.c alias.c
|
||||
OBJS = idl.o add.o search.o cache.o dbcache.o dn2id.o id2entry.o \
|
||||
OBJS = idl.o add.o search.o cache.o dbcache.o dn2id.o entry.o id2entry.o \
|
||||
index.o id2children.o nextid.o abandon.o compare.o group.o \
|
||||
modify.o modrdn.o delete.o init.o config.o bind.o attr.o \
|
||||
filterindex.o unbind.o kerberos.o close.o alias.o
|
||||
|
@ -218,8 +218,10 @@ return_results:;
|
||||
ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
|
||||
}
|
||||
|
||||
if ( rc ) {
|
||||
/* free entry and writer lock */
|
||||
cache_return_entry_w( &li->li_cache, e );
|
||||
}
|
||||
|
||||
return( rc );
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ ldbm_back_initialize(
|
||||
bi->bi_op_delete = ldbm_back_delete;
|
||||
bi->bi_op_abandon = ldbm_back_abandon;
|
||||
|
||||
bi->bi_entry_release_rw = ldbm_back_entry_release_rw;
|
||||
#ifdef SLAPD_ACLGROUPS
|
||||
bi->bi_acl_group = ldbm_back_group;
|
||||
#endif
|
||||
|
@ -75,6 +75,11 @@ Entry * dn2entry_rw LDAP_P(( Backend *be, char *dn, char **matched, int rw ));
|
||||
#define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0)
|
||||
#define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1)
|
||||
|
||||
/*
|
||||
* entry.c
|
||||
*/
|
||||
int ldbm_back_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
|
||||
|
||||
/*
|
||||
* filterindex.c
|
||||
*/
|
||||
|
@ -482,6 +482,21 @@ be_isroot_pw( Backend *be, char *ndn, struct berval *cred )
|
||||
return result == 0;
|
||||
}
|
||||
|
||||
int
|
||||
be_entry_release_rw( Backend *be, Entry *e, int rw )
|
||||
{
|
||||
int rc;
|
||||
|
||||
if ( be->be_release ) {
|
||||
/* free and release entry from backend */
|
||||
return be->be_release( be, e, rw );
|
||||
} else {
|
||||
/* free entry */
|
||||
entry_free( e );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
backend_unbind(
|
||||
Connection *conn,
|
||||
|
@ -72,6 +72,10 @@ int be_issuffix LDAP_P(( Backend *be, char *suffix ));
|
||||
int be_isroot LDAP_P(( Backend *be, char *ndn ));
|
||||
int be_isroot_pw LDAP_P(( Backend *be, char *ndn, struct berval *cred ));
|
||||
char* be_root_dn LDAP_P(( Backend *be ));
|
||||
int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
|
||||
#define be_entry_release_r( be, e ) be_entry_release_rw( be, e, 0 )
|
||||
#define be_entry_release_w( be, e ) be_entry_release_rw( be, e, 1 )
|
||||
|
||||
|
||||
extern int backend_unbind LDAP_P((Connection *conn, Operation *op));
|
||||
|
||||
|
@ -249,6 +249,7 @@ struct backend_db {
|
||||
#define be_modrdn bd_info->bi_op_modrdn
|
||||
#define be_search bd_info->bi_op_search
|
||||
|
||||
#define be_release bd_info->bi_entry_release_rw
|
||||
#define be_group bd_info->bi_acl_group
|
||||
|
||||
/* these should be renamed from be_ to bd_ */
|
||||
@ -361,6 +362,7 @@ struct backend_info {
|
||||
int msgid));
|
||||
|
||||
/* Auxilary Functions */
|
||||
int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw));
|
||||
#ifdef SLAPD_ACLGROUPS
|
||||
int (*bi_acl_group) LDAP_P((Backend *bd,
|
||||
Entry *e, char *bdn, char *edn,
|
||||
|
Loading…
Reference in New Issue
Block a user