From: Howard Chu Date: Thu, 13 Mar 2008 13:14:52 +0000 (+0000) Subject: ITS#5419 introduce OpExtra / op->o_extra to supersede op->o_private X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~92 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a55123477a76354a82829b2af8e233bb496db76f;p=openldap ITS#5419 introduce OpExtra / op->o_extra to supersede op->o_private --- diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index b36b65c3d1..e9c786cf95 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -1334,6 +1334,11 @@ be_entry_get_rw( return LDAP_UNWILLING_TO_PERFORM; } +typedef struct fe_extra { + OpExtra fe_oe; + BackendDB *fe_be; +} fe_extra; + int fe_acl_group( Operation *op, @@ -1586,8 +1591,17 @@ fe_acl_attribute( int freeattr = 0, i, j, rc = LDAP_SUCCESS; AccessControlState acl_state = ACL_STATE_INIT; Backend *be = op->o_bd; + fe_extra *fex; - op->o_bd = select_backend( edn, 0 ); + for ( fex = (fe_extra *)op->o_extra; fex; fex = (fe_extra *)fex->fe_oe.oe_next ) { + if ( fex->fe_oe.oe_key == (void *)frontend_init ) + break; + } + + if ( fex && fex->fe_be ) + op->o_bd = fex->fe_be; + else + op->o_bd = select_backend( edn, 0 ); if ( target && dn_match( &target->e_nname, edn ) ) { e = target; @@ -1706,13 +1720,18 @@ backend_attribute( slap_access_t access ) { int rc; - BackendDB *be_orig; + fe_extra fex; + + fex.fe_be = op->o_bd; + fex.fe_oe.oe_key = (void *)frontend_init; + fex.fe_oe.oe_next = op->o_extra; + op->o_extra = (OpExtra *)&fex; - be_orig = op->o_bd; op->o_bd = frontendDB; rc = frontendDB->be_attribute( op, target, edn, entry_at, vals, access ); - op->o_bd = be_orig; + op->o_bd = fex.fe_be; + slap_op_popextra( op, (OpExtra *)&fex ); return rc; } diff --git a/servers/slapd/operation.c b/servers/slapd/operation.c index b3ec0372bc..c159313ab3 100644 --- a/servers/slapd/operation.c +++ b/servers/slapd/operation.c @@ -184,6 +184,19 @@ slap_op_alloc( return( op ); } +void +slap_op_popextra( Operation *op, OpExtra *oe ) +{ + OpExtra **prev; + + for ( prev = &op->o_extra; *prev; prev = &(*prev)->oe_next ) { + if ( *prev == oe ) { + *prev = oe->oe_next; + break; + } + } +} + slap_op_t slap_req2op( ber_tag_t tag ) { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 69234d99fc..7c146fb836 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1394,10 +1394,8 @@ LDAP_SLAPD_F (Operation *) slap_op_alloc LDAP_P(( BerElement *ber, ber_int_t msgid, ber_tag_t tag, ber_int_t id, void *ctx )); -LDAP_SLAPD_F (int) slap_op_add LDAP_P(( Operation **olist, Operation *op )); -LDAP_SLAPD_F (int) slap_op_remove LDAP_P(( Operation **olist, Operation *op )); -LDAP_SLAPD_F (Operation *) slap_op_pop LDAP_P(( Operation **olist )); LDAP_SLAPD_F (slap_op_t) slap_req2op LDAP_P(( ber_tag_t tag )); +LDAP_SLAPD_F (void) slap_op_popextra LDAP_P(( Operation *op, OpExtra *oe )); /* * operational.c