AC_MEMCPY( be->be_ctrls, bi->bi_ctrls,
sizeof( be->be_ctrls ) );
be->be_ctrls[ SLAP_MAX_CIDS ] = 1;
-
+
} else {
int i;
-
+
for ( i = 0; i < SLAP_MAX_CIDS; i++ ) {
if ( bi->bi_ctrls[ i ] ) {
be->be_ctrls[ i ] = bi->bi_ctrls[ i ];
}
}
}
+
}
return 0;
}
-
/* startup a specific backend database */
int backend_startup_one(Backend *be)
{
int rc = 0;
+ assert( be );
+
be->be_pending_csn_list = (struct be_pcl *)
ch_calloc( 1, sizeof( struct be_pcl ));
"backend_startup_one: starting \"%s\"\n",
be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)",
0, 0 );
+
+ /* set database controls */
(void)backend_set_controls( be );
+
if ( be->bd_info->bi_db_open ) {
rc = be->bd_info->bi_db_open( be );
if ( rc == 0 ) {
return 0;
}
-static int
+int
backend_check_controls(
Operation *op,
SlapReply *rs )
default:
/* unreachable */
- rs->sr_err = "unable to check control";
+ rs->sr_text = "unable to check control";
rs->sr_err = LDAP_OTHER;
goto done;
}
LDAP_UNWILLING_TO_PERFORM, /* bind */
LDAP_UNWILLING_TO_PERFORM, /* unbind */
LDAP_UNWILLING_TO_PERFORM, /* search */
- LDAP_UNWILLING_TO_PERFORM, /* compare */
+ SLAP_CB_CONTINUE, /* compare; pass to frontend */
LDAP_UNWILLING_TO_PERFORM, /* modify */
LDAP_UNWILLING_TO_PERFORM, /* modrdn */
LDAP_UNWILLING_TO_PERFORM, /* add */
LDAP_UNWILLING_TO_PERFORM, /* extended */
LDAP_SUCCESS, /* aux_operational */
LDAP_SUCCESS, /* aux_chk_referrals */
- LDAP_SUCCESS /* aux_chk_controls */
+ SLAP_CB_CONTINUE /* aux_chk_controls; pass to frontend */
};
static int
return over_op_func( op, rs, op_aux_chk_controls );
}
+static int
+over_connection_destroy(
+ BackendDB *bd,
+ Connection *conn
+)
+{
+ slap_overinfo *oi;
+ slap_overinst *on;
+ BackendDB db;
+ int rc = SLAP_CB_CONTINUE;
+
+ /* FIXME: used to happen for instance during abandon
+ * when global overlays are used... */
+ assert( bd != NULL );
+
+ oi = bd->bd_info->bi_private;
+ on = oi->oi_list;
+
+ if ( !SLAP_ISOVERLAY( bd )) {
+ db = *bd;
+ db.be_flags |= SLAP_DBFLAG_OVERLAY;
+ bd = &db;
+ }
+
+ for (; on; on=on->on_next ) {
+ if ( on->on_bi.bi_connection_destroy ) {
+ bd->bd_info = (BackendInfo *)on;
+ rc = on->on_bi.bi_connection_destroy( bd, conn );
+ if ( rc != SLAP_CB_CONTINUE ) break;
+ }
+ }
+
+ if ( oi->oi_orig->bi_connection_destroy && rc == SLAP_CB_CONTINUE ) {
+ bd->bd_info = oi->oi_orig;
+ rc = oi->oi_orig->bi_connection_destroy( bd, conn );
+ }
+ /* should not fall thru this far without anything happening... */
+ if ( rc == SLAP_CB_CONTINUE ) {
+ rc = LDAP_UNWILLING_TO_PERFORM;
+ }
+
+ return rc;
+}
+
int
overlay_register(
slap_overinst *on
}
bd->be_ctrls[ cid ] = 1;
+ bd->be_ctrls[ SLAP_MAX_CIDS ] = 1;
}
}
if ( rc == 0 && !gotit ) {
be->be_ctrls[ cid ] = 1;
+ be->be_ctrls[ SLAP_MAX_CIDS ] = 1;
}
return rc;
bi->bi_operational = over_aux_operational;
bi->bi_chk_referrals = over_aux_chk_referrals;
bi->bi_chk_controls = over_aux_chk_controls;
+
+ bi->bi_connection_destroy = over_connection_destroy;
be->bd_info = bi;
parsePostRead, LDAP_SLIST_ENTRY_INITIALIZER(next) },
{ LDAP_CONTROL_VALUESRETURNFILTER,
(int)offsetof(struct slap_control_ids, sc_valuesReturnFilter),
- SLAP_CTRL_SEARCH, NULL,
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH, NULL,
parseValuesReturnFilter, LDAP_SLIST_ENTRY_INITIALIZER(next) },
{ LDAP_CONTROL_PAGEDRESULTS,
(int)offsetof(struct slap_control_ids, sc_pagedResults),
if ( cid ) *cid = ctrl->sc_cid;
- if ( ctrl->sc_mask & SLAP_CTRL_GLOBAL ) return LDAP_COMPARE_TRUE;
-
- if (( op->o_tag & LDAP_REQ_SEARCH ) &&
- ( ctrl->sc_mask & SLAP_CTRL_GLOBAL_SEARCH ))
+ if ( ( ctrl->sc_mask & SLAP_CTRL_GLOBAL ) ||
+ ( ( op->o_tag & LDAP_REQ_SEARCH ) &&
+ ( ctrl->sc_mask & SLAP_CTRL_GLOBAL_SEARCH ) ) )
{
return LDAP_COMPARE_TRUE;
}
- Debug( LDAP_DEBUG_ANY,
+ Debug( LDAP_DEBUG_TRACE,
"slap_global_control: unavailable control: %s\n",
oid, 0, 0 );
+
return LDAP_COMPARE_FALSE;
}
glueinfo *gi = (glueinfo *)on->on_bi.bi_private;
BackendDB *b0 = op->o_bd;
BackendInfo *bi0 = op->o_bd->bd_info;
- int rc;
+ int rc = SLAP_CB_CONTINUE;
op->o_bd = glue_back_select (b0, &op->o_req_ndn);
b0->bd_info = on->on_info->oi_orig;
- if ( op->o_bd->bd_info->bi_chk_controls )
+ /* if the subordinate database has overlays, the bi_chk_controls()
+ * hook is actually over_aux_chk_controls(); in case it actually
+ * wraps a missing hok, we need to mimic the behavior
+ * of the frontend applied to that database */
+ if ( op->o_bd->bd_info->bi_chk_controls ) {
rc = ( *op->o_bd->bd_info->bi_chk_controls )( op, rs );
- else
- rc = SLAP_CB_CONTINUE;
+ }
+
+
+ if ( rc == SLAP_CB_CONTINUE ) {
+ rc = backend_check_controls( op, rs );
+ }
op->o_bd = b0;
op->o_bd->bd_info = bi0;
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_check_controls LDAP_P((
+ Operation *op,
+ SlapReply *rs ));
LDAP_SLAPD_F( int ) backend_check_restrictions LDAP_P((
Operation *op,
SlapReply *rs,