From: Luke Howard Date: Mon, 8 Aug 2005 09:33:02 +0000 (+0000) Subject: Don't return frontend as SLAPI_BACKEND, return actual backend instead X-Git-Tag: OPENLDAP_AC_BP~56 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ef813684048f989bff8bef0c47f1b11bf157dc1f;p=openldap Don't return frontend as SLAPI_BACKEND, return actual backend instead for compat with 2.2 plugins Add a couple of backend SLAPI APIs --- diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index 7e53397419..e273295c1b 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -490,7 +490,7 @@ pblock_get( Slapi_PBlock *pb, int param, void **value ) break; case SLAPI_BACKEND: PBLOCK_ASSERT_OP( pb, 0 ); - *((BackendDB **)value) = pb->pb_op->o_bd; + *((BackendDB **)value) = select_backend( &pb->pb_op->o_req_ndn, 0, 0 ); break; case SLAPI_BE_TYPE: PBLOCK_ASSERT_OP( pb, 0 ); diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 8a7384687d..f2ac0cf24b 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -3452,6 +3452,33 @@ slapi_op_get_type(Slapi_Operation * op) return type; } +void slapi_be_set_readonly( Slapi_Backend *be, int readonly ) +{ + if ( be == NULL ) + return; + + if ( readonly ) + be->be_restrictops |= SLAP_RESTRICT_OP_WRITES; + else + be->be_restrictops &= ~(SLAP_RESTRICT_OP_WRITES); +} + +int slapi_be_get_readonly( Slapi_Backend *be ) +{ + if ( be == NULL ) + return 0; + + return ( (be->be_restrictops & SLAP_RESTRICT_OP_WRITES) == SLAP_RESTRICT_OP_WRITES ); +} + +const char *slapi_x_be_get_updatedn( Slapi_Backend *be ) +{ + if ( be == NULL ) + return NULL; + + return be->be_update_ndn.bv_val; +} + #if 0 void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag)