From 295f3ba0aa4cdce147612da6400f93e8f4b0a79f Mon Sep 17 00:00:00 2001 From: Mark Valence Date: Wed, 21 Jun 2000 17:23:24 +0000 Subject: [PATCH] New backend routine: back_attribute --- servers/slapd/back-ldbm/external.h | 7 +++++++ servers/slapd/back-ldbm/init.c | 1 + servers/slapd/backend.c | 29 +++++++++++++++++++++++++++++ servers/slapd/proto-slap.h | 9 +++++++++ servers/slapd/slap.h | 6 ++++++ 5 files changed, 52 insertions(+) diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h index b8c2a8d5fb..9c2944fefa 100644 --- a/servers/slapd/back-ldbm/external.h +++ b/servers/slapd/back-ldbm/external.h @@ -80,6 +80,13 @@ extern int ldbm_back_group LDAP_P(( BackendDB *bd, ObjectClass* group_oc, AttributeDescription* group_at)); +extern int ldbm_back_attribute LDAP_P(( BackendDB *bd, + Connection *conn, Operation *op, + Entry *target, + const char* e_ndn, + AttributeDescription* entry_at, + const char ***vals)); + /* hooks for slap tools */ extern int ldbm_tool_entry_open LDAP_P(( BackendDB *be, int mode )); diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index 6fb070b8b5..aff7a076b1 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -67,6 +67,7 @@ ldbm_back_initialize( bi->bi_entry_release_rw = ldbm_back_entry_release_rw; bi->bi_acl_group = ldbm_back_group; + bi->bi_acl_attribute = ldbm_back_attribute; bi->bi_chk_referrals = ldbm_back_referrals; /* diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index e6f5f7606f..02bfac50cc 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -667,6 +667,35 @@ backend_group( return LDAP_UNWILLING_TO_PERFORM; } +int +backend_attribute( + Backend *be, + Connection *conn, + Operation *op, + Entry *target, + const char *e_ndn, + AttributeDescription *entry_at, + const char ***vals +) +{ + if( target == NULL || strcmp( target->e_ndn, e_ndn ) != 0 ) { + /* we won't attempt to send it to a different backend */ + + be = select_backend(e_ndn); + + if (be == NULL) { + return LDAP_NO_SUCH_OBJECT; + } + } + + if( be->be_attribute ) { + return be->be_attribute( be, conn, op, target, e_ndn, + entry_at, vals ); + } + + return LDAP_UNWILLING_TO_PERFORM; +} + Attribute *backend_operational( Backend *be, Entry *e ) diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 354afa6f2f..8524add4b1 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -173,6 +173,15 @@ LDAP_SLAPD_F (int) backend_group LDAP_P((Backend *be, AttributeDescription *group_at )); +LDAP_SLAPD_F (int) backend_attribute LDAP_P((Backend *be, + Connection *conn, + Operation *op, + Entry *target, + const char *e_ndn, + AttributeDescription *entry_at, + const char ***vals +)); + LDAP_SLAPD_F (Attribute *) backend_operational( Backend *, Entry * ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 0b4171126f..f70ee5c756 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -757,6 +757,7 @@ struct slap_backend_db { #define be_release bd_info->bi_entry_release_rw #define be_chk_referrals bd_info->bi_chk_referrals #define be_group bd_info->bi_acl_group +#define be_attribute bd_info->bi_acl_attribute #define be_controls bd_info->bi_controls @@ -929,6 +930,11 @@ struct slap_backend_info { Entry *e, const char *bdn, const char *edn, ObjectClass *group_oc, AttributeDescription *group_at )); + int (*bi_acl_attribute) LDAP_P((Backend *bd, + struct slap_conn *c, struct slap_op *o, + Entry *e, const char *edn, + AttributeDescription *entry_at, + const char ***vals )); int (*bi_connection_init) LDAP_P((BackendDB *bd, struct slap_conn *c)); -- 2.39.5