From 7c96f629eee552d4e9992dea5aa5ad1e582063e0 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 29 Sep 2000 05:25:44 +0000 Subject: [PATCH] Add connection and operation arguments to backend callbacks. Needed for transactions. --- servers/slapd/acl.c | 2 +- servers/slapd/add.c | 2 +- servers/slapd/back-ldbm/attribute.c | 3 +-- servers/slapd/back-ldbm/external.h | 1 + servers/slapd/back-ldbm/group.c | 2 ++ servers/slapd/backend.c | 16 +++++++++++++--- servers/slapd/proto-slap.h | 23 +++++++++++++++-------- servers/slapd/result.c | 2 +- servers/slapd/slap.h | 7 +++++-- 9 files changed, 40 insertions(+), 18 deletions(-) diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 8079bdd15e..98b3ea32b0 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -619,7 +619,7 @@ acl_mask( buf[sizeof(buf) - 1] = 0; } - if (backend_group(be, e, buf, op->o_ndn, + if (backend_group(be, conn, op, e, buf, op->o_ndn, b->a_group_oc, b->a_group_at) != 0) { continue; diff --git a/servers/slapd/add.c b/servers/slapd/add.c index e2aad2ef70..86030d638e 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -237,7 +237,7 @@ do_add( Connection *conn, Operation *op ) { replog( be, op, e->e_dn, e ); } - be_entry_release_w( be, e ); + be_entry_release_w( be, conn, op, e ); e = NULL; } diff --git a/servers/slapd/back-ldbm/attribute.c b/servers/slapd/back-ldbm/attribute.c index a76d437415..eebada043e 100644 --- a/servers/slapd/back-ldbm/attribute.c +++ b/servers/slapd/back-ldbm/attribute.c @@ -28,8 +28,7 @@ ldbm_back_attribute( Entry *target, const char *e_ndn, AttributeDescription *entry_at, - struct berval ***vals -) + struct berval ***vals ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; Entry *e; diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h index 2bdac2f069..76a3771f05 100644 --- a/servers/slapd/back-ldbm/external.h +++ b/servers/slapd/back-ldbm/external.h @@ -74,6 +74,7 @@ extern int ldbm_back_abandon LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, ber_int_t msgid )); extern int ldbm_back_group LDAP_P(( BackendDB *bd, + Connection *conn, Operation *op, Entry *target, const char* gr_ndn, const char* op_ndn, diff --git a/servers/slapd/back-ldbm/group.c b/servers/slapd/back-ldbm/group.c index 512f8e6b80..decb193072 100644 --- a/servers/slapd/back-ldbm/group.c +++ b/servers/slapd/back-ldbm/group.c @@ -24,6 +24,8 @@ int ldbm_back_group( Backend *be, + Connection *conn, + Operation *op, Entry *target, const char *gr_ndn, const char *op_ndn, diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 2900d1b134..8f061ffff1 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -539,11 +539,16 @@ be_isroot_pw( Backend *be, } int -be_entry_release_rw( Backend *be, Entry *e, int rw ) +be_entry_release_rw( + BackendDB *be, + Connection *conn, + Operation *op, + Entry *e, + int rw ) { if ( be->be_release ) { /* free and release entry from backend */ - return be->be_release( be, e, rw ); + return be->be_release( be, conn, op, e, rw ); } else { /* free entry */ entry_free( e ); @@ -831,6 +836,8 @@ int backend_check_referrals( int backend_group( Backend *be, + Connection *conn, + Operation *op, Entry *target, const char *gr_ndn, const char *op_ndn, @@ -849,7 +856,8 @@ backend_group( } if( be->be_group ) { - return be->be_group( be, target, gr_ndn, op_ndn, + return be->be_group( be, conn, op, + target, gr_ndn, op_ndn, group_oc, group_at ); } @@ -887,6 +895,8 @@ backend_attribute( Attribute *backend_operational( Backend *be, + Connection *conn, + Operation *op, Entry *e ) { Attribute *a = NULL; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index ae4fb17e56..140f0e44fc 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -154,21 +154,22 @@ LDAP_SLAPD_F (int) be_isroot LDAP_P(( Backend *be, const char *ndn )); LDAP_SLAPD_F (int) be_isroot_pw LDAP_P(( Backend *be, Connection *conn, const char *ndn, struct berval *cred )); LDAP_SLAPD_F (char *) be_root_dn LDAP_P(( Backend *be )); -LDAP_SLAPD_F (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 ) +LDAP_SLAPD_F (int) be_entry_release_rw LDAP_P(( + BackendDB *be, Connection *c, Operation *o, Entry *e, int rw )); +#define be_entry_release_r( be, c, o, e ) be_entry_release_rw( be, c, o, e, 0 ) +#define be_entry_release_w( be, c, o, e ) be_entry_release_rw( be, c, o, e, 1 ) LDAP_SLAPD_F (int) backend_unbind LDAP_P((Connection *conn, Operation *op)); LDAP_SLAPD_F( int ) backend_check_restrictions LDAP_P(( - Backend *be, + BackendDB *be, Connection *conn, Operation *op, const char *extoid, const char **text )); LDAP_SLAPD_F( int ) backend_check_referrals LDAP_P(( - Backend *be, + BackendDB *be, Connection *conn, Operation *op, const char *dn, @@ -177,7 +178,9 @@ LDAP_SLAPD_F( int ) backend_check_referrals LDAP_P(( LDAP_SLAPD_F (int) backend_connection_init LDAP_P((Connection *conn)); LDAP_SLAPD_F (int) backend_connection_destroy LDAP_P((Connection *conn)); -LDAP_SLAPD_F (int) backend_group LDAP_P((Backend *be, +LDAP_SLAPD_F (int) backend_group LDAP_P((BackendDB *be, + Connection *conn, + Operation *op, Entry *target, const char *gr_ndn, const char *op_ndn, @@ -185,7 +188,7 @@ LDAP_SLAPD_F (int) backend_group LDAP_P((Backend *be, AttributeDescription *group_at )); -LDAP_SLAPD_F (int) backend_attribute LDAP_P((Backend *be, +LDAP_SLAPD_F (int) backend_attribute LDAP_P((BackendDB *be, Connection *conn, Operation *op, Entry *target, @@ -194,7 +197,11 @@ LDAP_SLAPD_F (int) backend_attribute LDAP_P((Backend *be, struct berval ***vals )); -LDAP_SLAPD_F (Attribute *) backend_operational( Backend *, Entry * ); +LDAP_SLAPD_F (Attribute *) backend_operational( + BackendDB *, + Connection *conn, + Operation *op, + Entry * ); diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 681dabad31..55da3e6f40 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -694,7 +694,7 @@ send_search_entry( /* eventually will loop through generated operational attributes */ /* only have subschemaSubentry implemented */ - aa = backend_operational( be, e ); + aa = backend_operational( be, conn, op, e ); for (a = aa ; a != NULL; a = a->a_next ) { AttributeDescription *desc = a->a_desc; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 4054963328..e4cad6f129 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -906,7 +906,7 @@ struct slap_op; typedef int (*SLAP_EXTENDED_FN) LDAP_P(( BackendDB *be, - struct slap_conn *conn, + struct slap_conn *conn, struct slap_op *op, const char *reqoid, struct berval * reqdata, @@ -1014,7 +1014,9 @@ struct slap_backend_info { SLAP_EXTENDED_FN bi_extended; /* Auxilary Functions */ - int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw)); + int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, + struct slap_conn *c, struct slap_op *o, + Entry *e, int rw)); int (*bi_chk_referrals) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o, @@ -1022,6 +1024,7 @@ struct slap_backend_info { const char **text )); int (*bi_acl_group) LDAP_P((Backend *bd, + struct slap_conn *c, struct slap_op *o, Entry *e, const char *bdn, const char *edn, ObjectClass *group_oc, AttributeDescription *group_at )); -- 2.39.5