X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fbackglue.c;h=cce5905ee1b827595b6ea2bd2a8037e8765a0804;hb=fb2d3926ce4714b83f76c059a18a0d67d12b8019;hp=434d29e643c3e32009920732a77890a6922026c3;hpb=a75a4f4eff1dbd98275348dcd00aef783e081c2f;p=openldap diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 434d29e643..cce5905ee1 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -262,6 +262,13 @@ glue_chk_controls ( Operation *op, SlapReply *rs ) return rc; } +/* ITS#4615 - overlays configured above the glue overlay should be + * invoked for the entire glued tree. Overlays configured below the + * glue overlay should only be invoked on the master backend. + * So, if we're searching on any subordinates, we need to force the + * current overlay chain to stop processing, without stopping the + * overall callback flow. + */ static int glue_sub_search( Operation *op, SlapReply *rs, BackendDB *b0, slap_overinst *on ) @@ -380,13 +387,13 @@ glue_op_search ( Operation *op, SlapReply *rs ) if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) { gs.err = LDAP_SUCCESS; } + op->ors_scope = LDAP_SCOPE_ONELEVEL; + op->o_req_dn = dn; + op->o_req_ndn = ndn; } else if (scope0 == LDAP_SCOPE_SUBTREE && dn_match(&op->o_bd->be_nsuffix[0], &ndn)) { - op->ors_scope = LDAP_SCOPE_SUBTREE; - op->o_req_dn = dn; - op->o_req_ndn = ndn; rs->sr_err = glue_sub_search( op, rs, b0, on ); } else if (scope0 == LDAP_SCOPE_SUBTREE && @@ -402,9 +409,6 @@ glue_op_search ( Operation *op, SlapReply *rs ) op->o_req_ndn = ndn; } else if (dnIsSuffix(&ndn, &op->o_bd->be_nsuffix[0])) { - op->ors_scope = scope0; - op->o_req_dn = dn; - op->o_req_ndn = ndn; rs->sr_err = glue_sub_search( op, rs, b0, on ); } @@ -778,6 +782,13 @@ glue_db_init( BackendInfo *bi = oi->oi_orig; glueinfo *gi; + if ( SLAP_GLUE_SUBORDINATE( be )) { + Debug( LDAP_DEBUG_ANY, "glue: backend %s is already subordinate, " + "cannot have glue overlay!\n", + be->be_suffix[0].bv_val, 0, 0 ); + return LDAP_OTHER; + } + gi = ch_calloc( 1, sizeof(glueinfo)); on->on_bi.bi_private = gi; dnParent( be->be_nsuffix, &gi->gi_pdn ); @@ -963,6 +974,12 @@ glue_sub_add( BackendDB *be, int advert, int online ) glue_Addrec *ga; int rc = 0; + if ( overlay_is_inst( be, "glue" )) { + Debug( LDAP_DEBUG_ANY, "glue: backend %s already has glue overlay, " + "cannot be a subordinate!\n", + be->be_suffix[0].bv_val, 0, 0 ); + return LDAP_OTHER; + } SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_GLUE_SUBORDINATE; if ( advert ) SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_GLUE_ADVERTISE;